I’m working on a legacy Rails 2.3.8 project and setting up a dev server.
I get errors when I try to run rake, and I realized I have the wrong version of Rake installed, in the Rakefile it says:
s.add_dependency 'rake', '>= 0.7.1'
and I have 0.9.2.2 installed. When I try to uninstall, I get
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, checkgem list -d rake
I don’t have RVM installed, and all the posts I see related to fixing this problem mentioned RVM, so I’m stuck.
I came across this error myself. I don’t know why it happened, but I did figure out how to fix it.
It is giving an error because it’s got a gemspec record without the actual gem in the gem directory.
You can fix this by manually deleting the gemspec in your gem directory.
First you need to figure out where the gem thinks it’s located. You can probably do this with:
If you are on *nix, you can also try
/usr/lib/ruby/gems/Otherwise google to figure out how to find your gem directoy.
the gem directory has subdirs, the ones that I found relevant for fixing this were:
gemsspecificationsandcacheYou’re looking for something like
rake-0.9.2.2If the gem were to be found in
gemsthen it would have uninstalled for me, but it wasn’t. However I did findrake-0.9.2.2.gemspecinspecificationsandrake-0.9.2.2.gemincache. When I deleted both of these, I stopped getting the error message.