Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 4/Ruby 2.0在执行rspec:install时出错_Ruby On Rails_Ruby_Rspec_Execjs - Fatal编程技术网

Ruby on rails Rails 4/Ruby 2.0在执行rspec:install时出错

Ruby on rails Rails 4/Ruby 2.0在执行rspec:install时出错,ruby-on-rails,ruby,rspec,execjs,Ruby On Rails,Ruby,Rspec,Execjs,我正在网上学习RubyonRails4教程。我执行了命令railsgenerate-rspec:install,得到了这个结果 rails生成rspec:install /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/ssteph

我正在网上学习RubyonRails4教程。我执行了命令
railsgenerate-rspec:install
,得到了这个结果

rails生成rspec:install

/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:4:in `<top (required)>'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in `require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in `<top (required)>'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/arman/rails_projects/sample_app/config/application.rb:12:in `<top (required)>'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in `require'
    from /home/arman/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs/runtimes.rb:51:在“自动检测”中:找不到JavaScript运行时。看见https://github.com/sstephenson/execjs 获取可用运行时的列表。(ExecJS::RuntimeUnavailable)
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:5:in`'
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:4:in`'
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in'require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.1/lib/uglifier.rb:3:in`'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in'require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in'block(2层)in require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'each'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'block in require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'each'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in'require'
from/home/arman/rails\u projects/sample\u app/config/application.rb:12:in`'
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in'require'
from/home/arman/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:44:in`'
从箱子/轨道:4:in“require”
从箱子/轨道:4:in`'
我不知道怎么解决这个问题

操作系统:Virtualbox上的Linux Mint 15 Ruby 2.0
Rails 4.0

让我们看看您在输出中得到了什么

找不到JavaScript运行时。有关可用运行时的列表,请参阅

嗯,听起来很有趣。让我们关注这个链接

ExecJS支持以下运行时:

  • -谷歌V8 嵌入Ruby中
  • -Mozilla 嵌入JRuby中的Rhino
  • Apple JavaScriptCore-随Mac OS X提供
  • (JScript)

我认为您应该安装其中一个。

您缺少javascript运行时,请参阅,或者只是运行
gem安装therubyracer
我正在安装therubyracer。它现在正在构建extensionOk,如果有任何问题,请告诉我们。我没有注意到在教程中提到可能缺少js运行时。并且有修复问题的链接。谢谢!安装nodejs解决了这个问题,我想同时安装rubyracer和nodejs有点过分了。其中一个应该足够了。