2012-01-15 64 views
8

我試圖將我的Rails應用程序升級到3.2.0.rc2,但是當我嘗試做一個rake db:migrate --trace我現在得到以下錯誤信息:不知道如何構建任務'db:migrate'w/Rails 3.2.0.rc2

DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4) 
rake aborted! 
Don't know how to build task 'db:migrate' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' 
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290[email protected]/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>' 
/Users/Kyle/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/Users/Kyle/.rvm/gems/[email protected]/bin/rake:19:in `<main>' 

棄用警告似乎是在application.rb關於這一行:

Bundler.require(:default, :assets, Rails.env) if defined?(Bundler) 

難道這被刪除或Rails的最新版本改變了嗎?我嘗試刪除這一行,然後再次運行遷移。然後我不再收到警告,但仍然得到Don't know how to build task 'db:migrate'錯誤。有任何想法嗎?

做一個bundle exec rake -T產生如下:

DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4) 
rake about        # List versions of all Rails frameworks and the environment 
rake assets:clean      # Remove compiled assets 
rake assets:precompile     # Compile all the assets named in config.assets.precompile 
rake cron        # This task is called by the Heroku cron add-on 
rake doc:app        # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/... 
rake friendlyid:rebuild     # Updates all User and Skatepark friendly IDs 
rake geocode:all       # Geocode all objects without coordinates. 
rake jobs:work       # Alias for resque:work (To run workers on Heroku) 
rake log:clear       # Truncates all *.log files in log/ to zero bytes 
rake middleware       # Prints out your Rack middleware stack 
rake notes        # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus) 
rake notes:custom      # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM 
rake rails:template      # Applies the template supplied by LOCATION=(/path/to/template) or URL 
rake rails:update      # Update configs and some other initially generated files (or use just update:configs, update:scripts... 
rake resque:scheduler     # Start Resque Scheduler 
rake resque:work       # Start a Resque worker 
rake resque:workers      # Start multiple Resque workers. 
rake routes        # Print out all defined routes in match order, with names. 
rake secret        # Generate a cryptographically secure secret key (this is typically used to generate a secret for coo... 
rake sorcery:bootstrap     # Adds sorcery's initializer file 
rake spec        # Run all specs in spec directory (excluding plugin specs) 
rake spec:controllers     # Run the code examples in spec/controllers 
rake spec:helpers      # Run the code examples in spec/helpers 
rake spec:lib       # Run the code examples in spec/lib 
rake spec:mailers      # Run the code examples in spec/mailers 
rake spec:models       # Run the code examples in spec/models 
rake spec:rcov       # Run all specs with rcov 
rake spec:requests      # Run the code examples in spec/requests 
rake spec:routing      # Run the code examples in spec/routing 
rake spec:views       # Run the code examples in spec/views 
rake stats        # Report code statistics (KLOCs, etc) from the application 
rake sunspot:reindex[batch_size,models] # Reindex all solr models that are located in your application's models directory. 
rake sunspot:solr:run     # Run the Solr instance in the foreground 
rake sunspot:solr:start     # Start the Solr instance 
rake sunspot:solr:stop     # Stop the Solr instance 
rake test        # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:... 
rake test:recent       # Run tests for {:recent=>"test:prepare"}/Test recent changes 
rake test:single       # Run tests for {:single=>"test:prepare"} 
rake test:uncommitted     # Run tests for {:uncommitted=>"test:prepare"}/Test changes since last checkin (only Subversion and... 
rake time:zones:all      # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET para... 
rake tmp:clear       # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tm... 
rake tmp:create       # Creates tmp directories for sessions, cache, sockets, and pids 

它將好像我所有的rake db任務缺失出現。

+0

捆綁exec耙 - T說? – phoet 2012-01-15 19:12:05

+0

更新了我的問題w /輸出。看起來所有的'rake db'任務都沒有了。 – 2012-01-15 19:36:54

+3

你是否在你的application.rb中做了'require'rails/all'',或者你正在加載一個子集? – 2012-01-15 19:38:36

回答

14

有一些非常時髦與您的寶石版本進行。如果你看看你的gemfile.lock,它使用的是3.2.rc2版本的railties,activesupport和activemodel,但其他版本都在這個地方(ar是1.6,action mailer是0.6.1等)。我不知道你是怎麼進入這個狀態的,但是我會嘗試bundle update或者刪除Gemfile.lock,然後運行bundle install(理論上這兩個是等價的)並且指定你想要的精確版本的rails特別是當你使用的是預裝版本的導軌時。)

+0

這似乎正在發生,因爲我沒有明確指定我的Gemfile中的'3.2.0.rc2'。我認爲只要放上'gem rails'就足夠了,但我猜不。這可能是一個錯誤瓦特/ Rails? – 2012-01-18 05:11:41

+0

如果它是捆綁器中的任何錯誤。也就是說嚴格說來,已經選擇的一組寶石確實與你的gemfile相匹配(可能是因爲一些舊版本對指定的版本更加寬鬆) – 2012-01-18 07:48:48

+0

刪除Gemfile.lock + bundle install工作得很完美。乾杯。 – 2014-02-27 21:15:55

5

從命令rake db:migrate --trace,不會裝載rake任務。 ,並且你無法獲得正確的路徑方案。 和運行rake -T本地列表db:migrate作爲rake任務之一?如果 不是,你的導軌配置錯誤... 好吧,我沒有使用導軌3.2.0rc2,但我GOOGLE了,發現一些鏈接。 低於此,請參閱鏈接會幫助你..

Rake db:migrate error don't know how to build task

Don't know how to build rake db:migrate on Ubuntu natty

Problem running rake db:migrate

讓我知道它是如何工作!

感謝弗雷德裏克,它的有趣的職位..

+1

謝謝,這個答案。它適合我。 – gsoni 2012-01-18 07:57:00

相關問題