How do I force execjs to use Node.js?

11,580

Solution 1

I figured out how to set the javascript runtime. In config/boot.rb I put the following line: ENV['EXECJS_RUNTIME'] = 'Node'

Solution 2

While Max 's answer is perfectly valid and good if you want to globally set this option, it's worth noting that there's a simpler way to do it. To print out the current runtime, after importing ExecJS via require 'execjs', just run

puts ExecJS.runtime.name

And to set the current runtime, just use

ExecJS.runtime = ExecJS::Runtimes::Node

Solution 3

If you still have public/index.html then it will show you what JS engine is used. If you don't have one then here you go https://gist.github.com/2029491.

Share:
11,580
Max
Author by

Max

Updated on June 07, 2022

Comments

  • Max
    Max about 2 years

    I have a rails app, and I want to force execjs to user Node.js as the javascript runtime. How do I even check which runtime execjs is using?

    Thanks.