Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I ran 'gem update' by accident can i revert it?

I ran 'gem update' to try to fix a problem in a different app i was working on. Now my main app doesn't work properly because i have a bunch of too-new gems. Is there a way to undo the gem update? Or revert my gems to the versions mentioned in my team's Gemfile.lock file?

Update: It specifically complains about Rake when i try to run 'rake spec' (Gem::LoadError: You have already activated rake 10.5.0, but your Gemfile requires rake 10.4.2. Prepending bundle exec to your command may solve this.)

like image 522
Veg Avatar asked Feb 08 '23 23:02

Veg


2 Answers

If you currently have a more recent version of a gem than is specified in your Gemfile.lock, then it should suffice to rewrite the Gemfile with the versions mentioned in Gemfile.lock and run a bundle install.

I tested this locally (downgraded a version in both Gemfile.lock and Gemfile) and bundler installed the old version without problems.

like image 81
Leo Brito Avatar answered Feb 16 '23 14:02

Leo Brito


Run 'gem uninstall rake' if you have multiple versions it will ask you which you wish to remove.

Then run 'gem install rake -v 10.4.2' to install the right version.

Worked for me and much less risky than bundle updating everything.

like image 40
Kate Wilkins Avatar answered Feb 16 '23 14:02

Kate Wilkins