2013-08-16 70 views
0

我正在使用gem版本2.0.7和rails版本3.0.7。如何解決rake db:在RoR中遷移錯誤?

雖然我運行rake db:migrate命令,但它拋出了以下錯誤。

$ rake db:migrate --trace 
rake aborted! 
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (ava 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rdoctask.rb:2:in `<top 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `loa 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `blo 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `each 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `<top 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214: 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214: 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139: 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:i 
C:/Users/m/Documents/Aptana Studio 3 Workspace/rail1/Rakefile:6:in `<top (requir 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `l 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `l 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:637:in ` 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:94:in `b 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in ` 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:93:in `l 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:77:in `b 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in ` 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `r 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)> 
c:/Ruby193/bin/rake:23:in `load' 
c:/Ruby193/bin/rake:23:in `<main>' 

如何解決它。

請給我留言。在此先感謝

回答

1

錯誤消息的關鍵部分是這樣的:

ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (ava 

如果您搜索的StackOverflow或谷歌的錯誤信息,你會發現在同一主題的至少有三個不同的問題,等等這樣的:

ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead

在寫作時的最高投票答案建議從編輯的Rakefile:

require 'rake' 
require 'rake/testtask' 
require 'rake/rdoctask' 
require 'tasks/rails' 

到:

require 'rake' 
require 'rake/testtask' 
require 'rdoc/task' 
require 'tasks/rails' 

如果我是你,我會嘗試升級的Rails 3.2,看看問題是否仍然存在。如果這不是一個選項,那麼較老的問題將有望得到幫助。

+0

我已經嘗試過改變,但它引發同一error.That。這就是爲什麼我張貼的問題 – selvam

+0

對。爲了將來的參考,如果你在問題中告訴我們你已經嘗試了什麼,它會讓人們更容易幫助。 – lime

+0

我改變了上面提到的rake文件。但這是行不通的。 – selvam

0

它可以通過安裝耙的舊版本,並卸載當前版本10.1.0來解決它:

gem install rake --version 0.8.7 
gem uninstall rake --version 10.1.0