错误:"rake/rdoctask"已过时,不再受支持 [英] ERROR: 'rake/rdoctask' is obsolete and no longer supported

查看:181
本文介绍了错误:"rake/rdoctask"已过时,不再受支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出乎意料的是,我开始收到以下错误消息:

Out of the blue, I started getting the following error message:

(in /Users/me/.rvm/gems/ruby-1.9.3-p125@mysql2/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/me/.rvm/gems/ruby-1.9.3-p125@mysql2/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'

当我使用rails时(在我的开发环境终端-Mac Mountain Lion中).该应用程序正在生产中,因此我进入了生产环境,进行了捆绑显示,并修改了我的Gemfile,以编码gems版本.

When I do rails s (in my development environment terminal - Mac Mountain Lion). This application is in production, so I went to the production environment, did a bundle show, and modified my Gemfile, to harcode the gems versions.

这就是我现在在本地开发环境中所拥有的(产生错误消息的原因).

Here's what I have now on my my local development environment (what's producing the error message).

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
annotate (2.4.1.beta1)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bootstrap-datepicker-rails (0.6.15)
bootstrap-sass (2.0.2)
builder (3.0.4)
bundler (1.1.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.1)
commonjs (0.2.6)
devise (2.0.4)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (3.2.0)
factory_girl_rails (3.2.0)
hike (1.2.1)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.1)
less (2.2.2)
less-rails (2.2.6)
libv8 (3.3.10.4)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
mysql2 (0.3.11)
nokogiri (1.5.6)
orm_adapter (0.0.7)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.3)
rdoc (3.4)
rest-client (1.6.7)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.2.7)
sass-rails (3.2.5)
sprockets (2.1.3)
stripe (1.7.0)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.5)
tinymce-rails (3.4.8)
treetop (1.4.12)
twitter-bootstrap-rails (2.1.0)
tzinfo (0.3.37)
uglifier (1.2.4)
warden (1.1.1)
webrat (0.7.1)

我研究了Stackoverflow和网络,但没有任何建议奏效(将rake gem版本更改为其他内容,例如0.8.7等,编辑我的应用程序Rakefile以抑制弃用错误等).我还添加了rdoc,并且在我的Rakefile中,我需要"rdoc/task"

I researched Stackoverflow and the web, and none of the suggestions worked (changing the rake gem version to something different. like 0.8.7, etc., editing my app Rakefile to suppress deprecation errors, etc.). I also added rdoc and in my Rakefile, I required 'rdoc/task'

仍然,同样的错误.

推荐答案

只是为了帮助其他遇到这种麻烦的人. 如果您像我一样,那么您的问题是rails的当前版本是4,并且您想使用3.0.7之类的旧版本

Just to help anyone else who has had this hassle. If you are like me, then your problem is that the current version of rails is 4 and you are wanting to use an older version like 3.0.7

例如,如果您新鲜安装rails来学习它,并且您正在使用的教程适用于3.0.x版本的rails,或者您的工作需要使用旧版本的rails ..那么您可以进入此漏洞.

If you install rails fresh to learn it ,say, and the tutorial you are using is for a 3.0.x version of rails OR your job requires the use of the older version of rails.. then you can get into this hole.

在我的情况下,我将3.0.7 rails项目丢到了我身上,并被告知要学习rails并对该代码进行一些增强.

In my case I got a 3.0.7 rails project dumped on me and was told to learn rails and make some enhancements to this code.

所以,我刚刚开始学习rails并一直按照本教程进行操作,直到在执行"rake db:migrate"时收到此错误为止

so, I just started learning rails and was following the tutorial until I got this error when doing a 'rake db:migrate'

rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `require'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `load'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block in <top (required)>'

发生这种情况是因为我使用的是旧版的rails ..就我而言,是3.0.7 如果像我那样运行"bundle show",您可能会看到您正在使用rake版本10.0.0或类似的东西...并且您需要运行rake 0.9.2 ...问题出在..

This happened cos I was using an older version of rails.. in my case 3.0.7 If you run a 'bundle show', like I did then, you may see that you are using the rake version 10.0.0 or something like that...and you need to be running rake 0.9.2 ... which is where the problem is coming from..

对我来说,解决方案是(a)将gem添加到我的gemfile中,以及(b)将其添加到捆绑安装中

The solution for me was to (a) add a gem to my gemfile and (b) to a bundle install

因此,在我的gemfile中,我添加了:

So, in my gemfile I added:

gem 'rake', '0.9.2'

然后做了

'bundle install'

收到此消息:

You have requested:
  rake = 0.9.2

The bundle currently has rake locked at 10.1.0.
Try running `bundle update rake`

所以我做到了...

bundle update rake.

那很好.

然后,当我执行'rake db:migrate'时,它就起作用了.

then when I did the'rake db:migrate' it just worked.

希望这对某人有帮助. 维达.

Hope this helps somebody. Vida.

PS:如果像我这样刚接触Rails的人,并且您继承了较旧的Rails应用程序,那么出于上帝的缘故,切勿运行捆绑更新",否则您将陷入痛苦的世界.该命令会将您所有的gem更新到最新版本,最终会导致大量不兼容的问题.唯一的解决方法是,如果您足够幸运地安装了git并可以执行"git checkout"回去...

PS: if you are new to rails, like me, and you inherit an older rails app then for gods sake NEVER run 'bundle update' or you will enter a world of pain. That command updates all your gems to the very latest versions and you end up with a load of problems with incompatibilities. The only way out of it is if you are lucky enough to have git installed and can do a 'git checkout' to go back...

这篇关于错误:"rake/rdoctask"已过时,不再受支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆