1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HOWTO: RubyOnRails + ExecJS + NodeJS - "Could not find a JavaScript runtime"

Discussion in 'Howtos and FAQs (Moderated)' started by akil, Nov 4, 2012.

  1. akil

    akil New Member

    Messages:
    42
    Likes Received:
    0
    Hi,

    There is alot of questions across internet about getting NodeJS working with ExecJS. Normally it works but with never version it doesn't and produce below message when using with Passenger
    Code:
    Could not find a JavaScript runtime. See [url]https://github.com/sstephenson/execjs[/url] for a list of available runtimes.
    
    I have installed www/node and accordingly modify rubygem /usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.0/lib/execjs/runtimes.rb file. Please check your versions for ruby and ExecJS gem, because my path could be different to your. Below are changes done by me to get NodeJS working without TheRubyRacer etc...

    Code:
    --- runtimes.rb-orig    2012-11-04 16:09:09.112122307 +0000
    +++ runtimes.rb 2012-11-04 15:57:36.934122659 +0000
    @@ -20,7 +20,7 @@
     
         Node = ExternalRuntime.new(
           :name        => "Node.js (V8)",
    -      :command     => ["node"],
    +      :command     => ["/usr/local/bin/node"],
           :runner_path => ExecJS.root + "/support/node_runner.js",
           :encoding    => 'UTF-8'
         )
    
    
    I didn't yet figure out why I have to specify full path to node. It is rather a workaround for current ExecJS or Passenger?.