2011-08-15 38 views
12

我試圖運行遷移,但不斷收到錯誤消息:取消激活寶石 - 「您已經激活了Rake 0.9.3.beta.1,但是我的Gemfile需要Rake 0.9.2」

rake aborted! Undefined method prerequisite for nil:NilClass. 

看來,不知何故,我激活的寶石叫rake 0.9.3.beta.1 - 可是,我卻因爲改變了寶石bundle install和運行bundle show耙子,它表明rake 0.9.2安裝。我第一次使用Git,所以我認爲它可能與仍在使用測試版rake的應用程序有關 - 但我已經完成了一次推送,並且它顯示gemfile已更新。我只能看到rake 0.9.2版本。我應該在哪裏看?

我也有一個Rails:Railtie棄用的警告 - 但我認爲這與我的遷移問題沒有任何關係。它告訴我在config/application.rb中使用config.app_generators而不是Railtie - 但我在文件中看不到它。

這是配置/ application.rb中文件

require File.expand_path('../boot', __FILE__) 

# Pick the frameworks you want: 
require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "active_resource/railtie" 
require "sprockets/railtie" 
Bundler.require *Rails.groups(:assets) if defined?(Bundler) 

module CrowdshareApp 
    class Application < Rails::Application 
    config.encoding = "utf-8" 
config.filter_parameters += [:password] 
config.assets.enabled = true 
    end 
end 

我的Gemfile看起來是這樣的:

source 'http://rubygems.org' 

gem 'rails', '3.1.0.rc5' 
gem 'sqlite3' 
group :assets do 
    gem 'sass-rails', "~> 3.1.0.rc" 
    gem 'coffee-rails', "~> 3.1.0.rc" 
    gem 'uglifier' 
end 

gem 'jquery-rails' 
group :development do 
    gem 'rspec-rails', '2.0.0.beta.18' 
end 

group :test do 
    gem 'rspec', '2.0.0.beta.18' 
end 

和Gemfile.lock的文件有以下幾點:

GEM 
    remote: http://rubygems.org/ 
    specs: 
    actionmailer (3.1.0.rc5) 
     actionpack (= 3.1.0.rc5) 
     mail (~> 2.3.0) 
    actionpack (3.1.0.rc5) 
     activemodel (= 3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
     builder (~> 3.0.0) 
     erubis (~> 2.7.0) 
     i18n (~> 0.6) 
     rack (~> 1.3.1) 
     rack-cache (~> 1.0.2) 
     rack-mount (~> 0.8.1) 
     rack-test (~> 0.6.0) 
     sprockets (~> 2.0.0.beta.12) 
    activemodel (3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
     bcrypt-ruby (~> 2.1.4) 
     builder (~> 3.0.0) 
     i18n (~> 0.6) 
    activerecord (3.1.0.rc5) 
     activemodel (= 3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
     arel (~> 2.1.4) 
     tzinfo (~> 0.3.29) 
    activeresource (3.1.0.rc5) 
     activemodel (= 3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
    activesupport (3.1.0.rc5) 
     multi_json (~> 1.0) 
    arel (2.1.4) 
    bcrypt-ruby (2.1.4-x86-mingw32) 
    builder (3.0.0) 
    coffee-rails (3.1.0.rc.5) 
     actionpack (~> 3.1.0.rc1) 
     coffee-script (>= 2.2.0) 
     railties (~> 3.1.0.rc1) 
     sprockets (>= 2.0.0.beta.9) 
    coffee-script (2.2.0) 
     coffee-script-source 
     execjs 
    coffee-script-source (1.1.2) 
    diff-lcs (1.1.2) 
    erubis (2.7.0) 
    execjs (1.2.4) 
     multi_json (~> 1.0) 
    hike (1.2.0) 
    i18n (0.6.0) 
    jquery-rails (1.0.13) 
     railties (~> 3.0) 
     thor (~> 0.14) 
    mail (2.3.0) 
     i18n (>= 0.4.0) 
     mime-types (~> 1.16) 
     treetop (~> 1.4.8) 
    mime-types (1.16) 
    multi_json (1.0.3) 
    nokogiri (1.5.0-x86-mingw32) 
    polyglot (0.3.2) 
    rack (1.3.2) 
    rack-cache (1.0.2) 
     rack (>= 0.4) 
    rack-mount (0.8.2) 
     rack (>= 1.0.0) 
    rack-ssl (1.3.2) 
     rack 
    rack-test (0.6.1) 
     rack (>= 1.0) 
    rails (3.1.0.rc5) 
     actionmailer (= 3.1.0.rc5) 
     actionpack (= 3.1.0.rc5) 
     activerecord (= 3.1.0.rc5) 
     activeresource (= 3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
     bundler (~> 1.0) 
     railties (= 3.1.0.rc5) 
    railties (3.1.0.rc5) 
     actionpack (= 3.1.0.rc5) 
     activesupport (= 3.1.0.rc5) 
     rack-ssl (~> 1.3.2) 
     rake (>= 0.8.7) 
     rdoc (~> 3.4) 
     thor (~> 0.14.6) 
    rake (0.9.2) 
    rdoc (3.9.2) 
    rspec (2.0.0.beta.18) 
     rspec-core (= 2.0.0.beta.18) 
     rspec-expectations (= 2.0.0.beta.18) 
     rspec-mocks (= 2.0.0.beta.18) 
    rspec-core (2.0.0.beta.18) 
    rspec-expectations (2.0.0.beta.18) 
     diff-lcs (>= 1.1.2) 
    rspec-mocks (2.0.0.beta.18) 
    rspec-rails (2.0.0.beta.18) 
     rspec (>= 2.0.0.beta.14) 
     webrat (>= 0.7.0) 
    sass (3.1.7) 
    sass-rails (3.1.0.rc.5) 
     actionpack (~> 3.1.0.rc1) 
     railties (~> 3.1.0.rc1) 
     sass (>= 3.1.4) 
     sprockets (>= 2.0.0.beta.9) 
    sprockets (2.0.0.beta.13) 
     hike (~> 1.2) 
     rack (~> 1.0) 
     tilt (!= 1.3.0, ~> 1.1) 
    sqlite3 (1.3.4-x86-mingw32) 
    thor (0.14.6) 
    tilt (1.3.2) 
    treetop (1.4.10) 
     polyglot 
     polyglot (>= 0.3.1) 
    tzinfo (0.3.29) 
    uglifier (1.0.0) 
     execjs (>= 0.3.0) 
     multi_json (>= 1.0.2) 
    webrat (0.7.3) 
     nokogiri (>= 1.2.0) 
     rack (>= 1.0) 
     rack-test (>= 0.5.3) 

PLATFORMS 
    x86-mingw32 

DEPENDENCIES 
    coffee-rails (~> 3.1.0.rc) 
    jquery-rails 
    rails (= 3.1.0.rc5) 
    rspec (= 2.0.0.beta.18) 
    rspec-rails (= 2.0.0.beta.18) 
    sass-rails (~> 3.1.0.rc) 
    sqlite3 
    uglifier 

回答

18

嘗試刪除您的Gemfile.lock文件並再次運行bundle install

+9

'捆綁update'也對我的作品 – zires

+0

酷,消除Gemfile.lock的爲我工作!謝謝! – jlstr

+2

刪除你的Gemfile.lock可能真的搞砸了。這是有原因的。基本上你正在運行軟件包更新,它會將你所有的寶石更新到最新的兼容版本。 –

5

對我而言,另一種方式是去Gemfile.lock並將Rake版本從0.9.2.2更改爲0.9.3.beta.1。

+0

巧妙!我使用這個技巧來製作Ruby 2 + Rails 4.這不是因爲Railties 4需要Rdoc〜> 3.4而是Ruby 2需要Rdoc 4.缺點是下一代Gemfile.lock會讓我的項目失敗if我忘了再次編輯它,我相信我會忘記它。 – Ando

相關問題