简体   繁体   English

宝石在轨道上的红宝石

[英]gems in ruby on rails

I'm trying to run rails server on the command prompt in windows os and the following error is shown. 我试图在Windows操作系统的命令提示符下运行Rails服务器,并显示以下错误。

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/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-1.4.0/l
ib/execjs.rb:5:in `<module:ExecJS>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/l
ib/execjs.rb:4:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-script-
2.2.0/lib/coffee_script.rb:1:in `require'
        from C:/RailsInstaller/Ruby1.9.3/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.3/lib/ruby/gems/1.9.1/gems/coffee-script-
2.2.0/lib/coffee-script.rb:1:in `require'
        from C:/RailsInstaller/Ruby1.9.3/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.3/lib/ruby/gems/1.9.1/gems/coffee-rails-3
.2.2/lib/coffee-rails.rb:1:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-rails-3
.2.2/lib/coffee-rails.rb:1: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 C:/Sites/priya/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:53:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:53:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:50:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

I've downloaded execjs and copied the file in my project folder. 我已经下载了execjs并将文件复制到我的项目文件夹中。 But there is no change. 但是没有变化。 Please tell me how to fix this problem. 请告诉我如何解决此问题。

The error is 错误是

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

If you use Rails 3 and enable the asset pipeline, you need an asset compiler. 如果使用Rails 3并启用资产管道,则需要资产编译器。 ExecJS supports these runtimes, as explained in the documentation page: ExecJS支持这些运行时,如文档页面所述:

  • therubyracer - Google V8 embedded within Ruby therubyracer-Ruby中嵌入的Google V8
  • therubyrhino - Mozilla Rhino embedded within JRuby therubyrhino-嵌入JRuby的Mozilla Rhino
  • Node.js Node.js
  • Apple JavaScriptCore - Included with Mac OS X Apple JavaScriptCore-包含在Mac OS X中
  • Microsoft Windows Script Host (JScript) Microsoft Windows脚本宿主(JScript)

Follow the instructions at https://github.com/sstephenson/execjs to install one of them. 按照https://github.com/sstephenson/execjs上的说明安装其中之一。 Since you use Windows, you may want to try Microsoft Windows Script Host first. 由于使用Windows,因此您可能想先尝试使用Microsoft Windows Script Host。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM