1

我开始在rails上做一些试验。今天我试图启动 rails 服务器,但我的 Cmd 抛出了这个异常:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/run
times.rb:51: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.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/l
ib/execjs.rb:5:in `<module:ExecJS>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/l
ib/execjs.rb:4:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/uglifier-2.2.1
/lib/uglifier.rb:3:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/uglifier-2.2.1
/lib/uglifier.rb:3:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler.rb:132:in `require'
        from D:/Datos/Dropbox/Desarrollo/AprendiendoRuby/Rails/MiPrimerRailsApp/
config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

我也尝试重新安装 rails 并运行 bundle install。我在 GemFile 中添加了一行,但没有得到解决方案。我究竟做错了什么?

4

2 回答 2

1

安装execjstherubyracer宝石

将以下内容添加到 Gemfile

gem 'execjs'

gem 'therubyracer'

然后运行

bundle install
于 2013-10-16T18:33:31.460 回答
0

一、Could not find a JavaScript runtime. See https://gi thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn available)
二,千万别尝试用windows做rails开发,守护你的健康

于 2013-10-16T18:24:32.277 回答