繁体   English   中英

rpsec耙终止! 加载错误

[英]Rpsec rake aborted! Load error

我正在尝试运行Test First Ruby(来自http://testfirst.org/的Ruby教程)。 作为作业的一部分,我必须完成练习。

我安装了Ruby 2.0.0和rspec(需要它)。 但是,当我尝试从命令行窗口运行“ rake”时,出现错误消息:

rake aborted!
Gem::LoadError: Could not find 'rspec' (~> 2) - did find: [rspec-3.0.0]
C:/Users/Motiur/Desktop/test-first-ruby-master/Rakefile:2:in '<top (required)>'
(See full trace by running task with --trace)

按照建议运行跟踪时:

C:\Users\Motiur\Desktop\test-first-ruby-master\00_hello>rake --trace
(in C:/Users/Motiur/Desktop/test-first-ruby-master)
rake aborted!
Gem::LoadError: Could not find 'rspec' (~> 2) - did find: [rspec-3.0.0]
C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs'
C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
C:/Users/Motiur/Desktop/test-first-ruby-master/Rakefile:2:in `<top (required)>'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:i
n `load'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:i
n `load_rakefile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:
in `raw_load_rakefile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:i
n `block in load_rakefile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:
in `standard_exception_handling'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:i
n `load_rakefile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:i
n `block in run'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:
in `standard_exception_handling'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:i
n `run'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (requir
ed)>'
C:/Ruby200-x64/bin/rake:23:in `load'
C:/Ruby200-x64/bin/rake:23:in `<main>'

我尝试过重新安装Ruby&Rspec,甚至在两台不同的计算机上尝试过,但都遇到了相同的错误。 也许我安装不正确? 请帮忙。 谢谢!

在运行rake之前,应该运行bundle install 这仅需要执行一次。 如果在运行bundle时找不到命令,请安装bundler gem。 这可以通过gem install bundler

供您参考, bundle是捆绑程序gem中的命令。 在红宝石中,宝石是包裹。 它们通常包含库,但是有时它们包含工具和其他精美的东西。 Bundler用于管理依赖项。

要使用捆绑程序,您必须编写一个Gemfile(放在应用程序根目录中的名为Gemfile的实际文件)。 该Gemfile定义了您的应用程序所需的所有gem。 运行bundle install ,它会查看Gemfile并安装所需的所有gem。

据我了解,您所遵循的教程已经带有一个Gemfile。 您需要做的就是运行bundle install

暂无
暂无

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

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