簡體   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