问题
I'm completely new to Ruby on Rails, and I'm having trouble setting it up on my Windows PC. I have successfully followed the instructions on http://rubyonrails.org/download. However, when I go to run the rails server
command I come up with this output:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `a
utodetect': Could not find a JavaScript runtime. See https://github.com/sstephen
son/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:5:in
`<module:ExecJS>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:4:in
`<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_
script.rb:1:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_
script.rb:1:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-
script.rb:1:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-
script.rb:1:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee-r
ails.rb:1:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee-r
ails.rb:1:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:68:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:68:in `block (2 levels) in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:66:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:66:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:55:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runt
ime.rb:55:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:1
22:in `require'
from C:/RoR/tickets/config/application.rb:7:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When i go to the website https://github.com/sstephenson/execjs I'm still uncertain of how to proceed. Can someone point me in the right direction (remember I'm a newbie)? Thanks!
回答1:
I met that problem too The solution for me is just add
C:\Windows\System32
to the PATH
and restart your computer.
回答2:
I got it working by installing node.js from http://nodejs.org/ (INSTALL link) and added its install path (includes node.exe) to my windows user ' Path' environment variable. I also added Yang's reply path to above mentioned windows variable.
回答3:
This may not be a universally popular answer, but for a new user, I would comment out the lines in the gemfile that are loading sass and coffeescript. Not that they are at all bad - but I think they add unnecessary complication for someone getting to grips with the framework. Alternatively if you are already familiar with these components, then you just need to install a javascript runtime -I use node.js
来源:https://stackoverflow.com/questions/8047651/no-javascript-runtime-on-windows-when-running-rails-server