运行rails服务器时,Windows上没有Javascript运行时

我是Ruby on Rails的新手,我在Windows PC上设置它时遇到了麻烦。 我已成功按照http://rubyonrails.org/download上的说明操作。 但是,当我去运行rails server命令时,我想出了这个输出:

 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 `' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:4:in `' 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 `' 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 `' 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 `' 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 `' 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 ' 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 `' from script/rails:6:in `require' from script/rails:6:in `' 

当我访问网站https://github.com/sstephenson/execjs时,我仍然不确定如何继续。 有人能指出我正确的方向(还记得我是新手)吗? 谢谢!

我也遇到了这个问题我的解决方案就是添加

 C:\Windows\System32 

到了PATH

并重新启动计算机。

我通过从http://nodejs.org/ (安装链接)安装node.js并将其安装路径(包括node.exe)添加到我的Windows用户’Path’环境变量中来实现它。 我还将Yang的回复路径添加到上面提到的windows变量中。

这可能不是一个普遍流行的答案,但对于新用户,我会注释掉gemfile中加载sass和coffeescript的行。 并不是说它们一点都不好 – 但我认为它们为那些掌握框架的人增加了不必要的复杂性。 或者,如果您已经熟悉这些组件,那么您只需安装一个javascript运行时 – 我使用node.js