Max
Max

Reputation: 15975

How do I force execjs to use Node.js?

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.

Upvotes: 31

Views: 12957

Answers (3)

Drew
Drew

Reputation: 534

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

Upvotes: 21

Max
Max

Reputation: 15975

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

Upvotes: 32

Hauleth
Hauleth

Reputation: 23566

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.

Upvotes: 4

Related Questions