2010-08-01 66 views
2

我收到此錯誤耙分貝:遷移不是爲我工作

 
rake db:migrate (in 
    /Users/john/Sites/my_app) rake aborted! 
    Don't know how to build task 
    'db:migrate' 

當我跟蹤錯誤,我得到

rake aborted! Don't know how to build task 'db:migrate' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2050:in `invoke_task' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 
/usr/local/bin/rake:19:in `load' /usr/local/bin/rake:19 

我的Rake文件是

require(File.join(File.dirname(__FILE__), 'config', 'boot')) 

require 'rake' 
require 'rake/testtask' 
require 'rake/rdoctask' 

回答

1

的Ruby on Rails 2.3你應該在你的Rakefile結尾處有下面的附加行:

require 'tasks/rails' 
+0

當我補充一點,我得到 沒有這樣的文件加載 - 規格/耙/ spectask – Trace 2010-08-01 14:28:03

+2

@約翰,你可能已經得到正試圖'需要「的投機/耙/ spectask''任務,但你沒有安裝或加載rspec。嘗試運行'rake --trace db:migrate'來查看哪個任務文件導致了問題。 – 2010-08-01 14:42:09