2012-07-24 99 views
4

這是一個奇怪的。當我運行耙測試而不是遷移時發生這個錯誤。我正在運行RVM,下面的shell轉儲應該提供您需要的任何信息。找不到耙0.9.2.2在任何來源

任何幫助將不勝感激。我已經看到其他一些人遇到這個問題,但沒有解決方案,但仍然爲我(或他們)工作。

謝謝。

$ rake 
Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 
Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 
Errors running test:units, test:functionals, test:integration! 



$ ruby -v 
    ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] 
    $ rails -v 
    Rails 3.1.6 

$ more .rvmrc 
rvm [email protected] 
$ rake db:rollback 
== AddAllLocationsToAlert: reverting ========================================= 
-- remove_column(... 
    -> 0.0320s 
== AddAllLocationsToAlert: reverted (0.0321s) ================================ 

-------編輯::::

因爲我已經升級到最新的Rails - 3.2.6。即使我使用'bundle exec',錯誤仍然會發生。 (這對於3.2.6來說並不新鮮 - 我仍然在3.1下得到這個問題)雖然未定義的方法是新的。

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 
$ bundle exec rake 
Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 
Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 
Errors running test:units! #<NoMethodError: undefined method `[]' for nil:NilClass> 
Errors running test:functionals! #<RuntimeError: Command failed with status (7): [/Users/ben/.rvm/rubies/ruby-1.9.3-p194/bin...]> 
Errors running test:integration! #<RuntimeError: Command failed with status (7): [/Users/ben/.rvm/rubies/ruby-1.9.3-p194/bin...]> 

我的Gemfile,如要求:

source 'http://rubygems.org' 

gem 'rails', '3.2.6' 

group :assets do 
    gem 'sass-rails', " ~> 3.2.5" 
    gem 'coffee-rails', "~> 3.2.1" 
    gem 'uglifier', '>= 1.2.6' 
end 

gem 'jquery-rails' 

gem 'rake' 
gem "mysql2" 

gem "squeel" 
gem 'tinymce-rails' 
gem 'dynamic_form' 

gem 'will_paginate' 
gem 'devise' 
gem 'whitelist' 
gem 'rmagick' 
gem 'json' 
gem 'paperclip' 
gem 'acts_as_list', :git => 'https://github.com/swanandp/acts_as_list' 
gem 'htmlentities' 
gem 'formtastic' 
# Bundle gems for the local environment. Make sure to 
# put test-only gems in this group so their generators 
# and rake tasks are available in development mode: 
# group :development, :test do 
# gem 'webrat' 
# end 
+1

'gem install rake'不起作用? – bender 2012-07-24 09:08:38

+0

Gemfile的'test'組中的gem可能取決於不同版本的'rake',而不是你的系統中安裝的'rake'版本。 – 2012-07-24 09:26:22

+0

Bender:沒有。 ( Michal:現在提示可能發生的事情我在Gemfile中沒有一個測試組 - 這是基於一箇舊項目,它已經從第1軌到第3軌,第3.1軌現在3.2,所以我沒有使用完整的功能集,但是,有一些舊的寶石懸掛在其中,可能會導致一些Rake問題。 奇怪的是,它只是測試我得到它如此爲什麼遷移工作? – 2012-07-24 11:16:15

回答

0

如果您在使用捆綁(與軌道,你可能做的),始終運行耙這樣的:

bundle exec rake

這將拾取您的Gemfile中指定的寶石。

+0

這是其他類似線程提供的潛在解決方案之一。很不幸的是,不行。L :( – 2012-07-24 11:04:07

+0

更新了最初的帖子,以反映這個建議失敗。(所以沒有sarky評論,讀者) – 2012-07-24 11:17:06

+0

順便說一句,我一直對這個功能感到困惑,它真的讓人不舒服 在過去,我得到了它通過卸載我不想要的寶石版本,但目前我只有一個版本 - 它要求的版本! 我只能假定代碼中的某個地方沒有滿足依賴關係,並且錯誤消息很困惑返回當前的寶石版本,而不是所需的...但我不知道如何在這裏深入挖掘 – 2012-07-24 11:35:34

3

寶石 '耙', 「> = 0.9.2」 #在你的Gemfile

然後

$捆綁安裝

然後

$捆綁高管耙

如果上面沒有工作:

$ rvm all gem install rake -v 0.9.2 .2#安裝耙子到所有紅寶石版本

然後再次運行耙子

+0

這是一個有用的小rmv命令,@艾哈邁德。感謝那。 – harperville 2013-07-03 19:54:30

+0

很高興幫助! – 2013-07-31 09:48:21

相關問題