0

我正在使用 gem 2.0.7 版和 rails 3.0.7 版。

当我运行 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>'

如何解决它。

请帮帮我。提前致谢

4

2 回答 2

1

错误消息的关键部分是:

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

如果您在 StackOverflow 或 Google 上搜索错误消息,您会发现至少三个关于同一主题的不同问题,其中包括:

错误:“rake/rdoctask”已过时,不再受支持。改用“rdoc/task”(在 RDoc 2.4.2+ 中可用)

在撰写本文时投票最高的答案建议从以下位置编辑您的 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,看看问题是否仍然存在。如果这不是一个选项,那么较旧的问题有望有所帮助。

于 2013-08-16T07:04:08.943 回答
0

它可以通过安装旧版本的 rake 并卸载当前的 10.1.0 版本来解决:

gem install rake --version 0.8.7
gem uninstall rake --version 10.1.0
于 2013-08-16T07:08:09.957 回答