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

Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

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

Postby akil » 04 Nov 2012, 15:30

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: Select all
Could not find a JavaScript runtime. See [url]https://github.com/sstephenson/execjs[/url] for a list of available runtimes.


I have installed [PORT]www/node[/PORT] and accordingly modify rubygem [FILE]/usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.0/lib/execjs/runtimes.rb[/FILE] 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: Select all
--- 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 [FILE]node[/FILE]. It is rather a workaround for current ExecJS or Passenger?.
akil
Junior Member
 
Posts: 42
Joined: 31 Aug 2011, 05:55
Location: Poland

Return to Howtos & FAQs (Moderated)

Who is online

Users browsing this forum: No registered users and 0 guests