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

送分小仙女□ 提交于 2019-11-27 18:08:22

I had similar problem using rails 2.3.5 so as instructed in the trace message I have edited the Rakefile to require 'rdoc/task' instead of rake/rdoctask and installed rdoc gem.

If you are using rake version > 10.0.0 . please edit your Rakefile

from:

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

to:

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

If you don't want to edit the Rakefile you can switch back to older version of take like this

gem uninstall rake -v 10.0.3
gem install rake -v 0.8.7

I ran into similar problem when migrating my old app to rails 2.3.15. I solved it by installing an older version of rake, and uninstalling current 10.0.3 version:

gem install rake --version 0.8.7
gem uninstall rake --version 10.0.3

I got it to work by putting

gem 'rake', '0.9.2.2'

in my Gemfile and then running rake as

bundle exec rake db:migrate

I had to fix this while not breaking on places that have old rake but not rdoc installed. I added a begin...rescue clause:

begin
  require 'rake/rdoctask'
rescue
  require 'rdoc/task'
end

I came across the same issue...I did what GiridharBandi mentioned above:

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

to:

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

Rake version 10.0.4 was there in the gem list but when I tried to uninstall, it said that rake is not installed. So I ignored this and proceeded to install rake 0.8.7. Once its installed, I installed rdoc

gem install rdoc

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

and then everything started working just fine.

For rails 3.0.6, with the same kind of error:

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

I installed rake 0.9.2 and also rdoc. commented out the #require 'tasks/rails' and then everything started working. I think rake problem is resolved in rails > 3.2.9.

markussvensson

I had a similar problem recently.

Looks like the same problem as: Can't run any rake command: "ERROR: 'rake/rdoctask' is obsolete and no longer supported"

I solved it by upgrading to Rails 3.2.9.

Like the original poster, I don't have a require of rake/rdoctask. Upgrading my rails is not an option. The answer is to keep your rake at 0.9.2.2 in your Gemfile.

This probably isn't the right way to do this, but I went into my Gemfile.lock file and changed my rake version back from 10.0.3 to 0.8.7. I'm running Rails 3.0.5 right now, and had updated briefly to 3.0.19 before reverting back. I believe that updated some gems and also made it so that the Rails gem was looking for the newest version greater than or equal to 0.8.7:

rails (3.0.5)
  actionmailer (= 3.0.5)
  actionpack (= 3.0.5)
  activerecord (= 3.0.5)
  activeresource (= 3.0.5)
  activesupport (= 3.0.5)
  bundler (~> 1.0)
  railties (= 3.0.5)
railties (3.0.5)
  actionpack (= 3.0.5)
  activesupport (= 3.0.5)
  rake (>= 0.8.7)
  thor (~> 0.14.4)
rake (0.8.7)

I also uninstalled 10.0.3:

gem uninstall rake --version 10.0.3

After that, everything is back to running as it should.

If I didn't roll back rails 3.0.19, then I would have kept using rake 10.0.3.

Hope this helps someone!

I run into this whenever I have a Bundler-based project and I'm using Ruby 1.9.2. Eventually I figure out that Bundler isn't managing the rdoc gem, and all I have to do to fix the problem is include rdoc in the Gemfile (or the gemspec if Gemfile is already configured to use it) and run bundle install.

I never seem to run into this with 1.9.3 or 2.0.0, only 1.9.2.

Oh my god, I was figting with this for almost hour and finally here is my case (may help someone :) ): I got myself multiple rails versions installed so I just uninstalled the latest one as I want to use the most edgy one (the 4.0.1 for now)

so :

$ gem uninstall rails

and I got this:

Select gem to uninstall:
 1. rails-0.9.5
 2. rails-4.0.0
 3. rails-4.0.1
 4. All versions
>

so I selected first two and that was it :) now everything is OK hope this helps someone who got mysteriously stuck as me :(

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!