HELP!! "Could not find a JavaScript runtime " ERROR

Hello ALL, I'm new to RoR, I get the following error stack whenever I issue "rails server" or "rails generate ..." command.

Thanks in advance!

ERROR STACK:

C:\Sites\demo_app>rails generate scaffold User name:string email:string C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/execjs-1.2.6/lib/ execjs/run times.rb:46:in `autodetect': Could not find a JavaScript runtime. See https://gi thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn available)         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ execjs-1.2.6/l ib/execjs.rb:5:in `<module:ExecJS>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ execjs-1.2.6/l ib/execjs.rb:4:in `<top (required)>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-script- 2.2.0/lib/coffee_script.rb:1:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-script- 2.2.0/lib/coffee_script.rb:1:in `<top (required)>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-script- 2.2.0/lib/coffee-script.rb:1:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-script- 2.2.0/lib/coffee-script.rb:1:in `<top (required)>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-rails-3 .1.1/lib/coffee-rails.rb:1:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ coffee-rails-3 .1.1/lib/coffee-rails.rb:1:in `<top (required)>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:68:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:68:in `block (2 levels) in require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:66:in `each'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:66:in `block in require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:55:in `each'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler/runtime.rb:55:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ bundler-1.0.18 /lib/bundler.rb:120:in `require'         from C:/Sites/demo_app/config/application.rb:7:in `<top (required)>'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ railties-3.1.0 /lib/rails/commands.rb:21:in `require'         from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/ railties-3.1.0 /lib/rails/commands.rb:21:in `<top (required)>'         from script/rails:6:in `require'         from script/rails:6:in `<main>'

C:\Sites\demo_app>

You need to have a Javascript runtime installed. Either install node.js directly or include therubyracer gem. This has been discussed on this list multiple times.

You could have read this line of the stacktrace, it’s pointing you to a page where several JavaScript runtimes are listed.

Bye Norbert

add

gem ‘therubyracer’

to your Gemfile

run

bundle install

FWIW: This is the kind of question that will get you a bad reputation on mailing lists. Typing in execjs and javascript into google returned this link: http://stackoverflow.com/questions/6282307/rails-3-1-execjs-and-could-not-find-a-javascript-runtime

which explains what you need to do. Instead you used up scarce resources (the time of the people reading this list) that could have benefited others.

Please think about this and invest a bit more time before you ask the next time, but do ask when you have a problem that you cannot solve even after googeling.

I just noticed that you are using a Windows PC. In this case therubyracer will not work.

Take a look at https://github.com/sstephenson/execjs and google for execjs and windows.