'How does one upgrade a specific ruby gem to a specific (or the latest) version?
I am trying to upgrade a gem (hydra-derivatives) to version 3.3.2 to see if it solves a bug we are having.
hydra-derivatives is not a Gemfile gem; it's bundled as a dependency of another gem, called hydra-works.
What I've Tried
bundle update --conservative hydra-derivativesbut that only upgraded hydra-derivatives to 3.2.2 (& we want 3.3.2) and its dependencymini_magickfrom 4.5.1 to 4.8.0adding
gem 'hydra-derivatives', '~> 3.3.2'but that gave me:You have requested: hydra-derivatives ~> 3.3.2 The bundle currently has hydra-derivatives locked at 3.2.1. Try running `bundle update hydra-derivatives` If you are updating multiple gems in your Gemfile at once, try passing them all to `bundle update`I don't want to run
bundle update hydra-derivativesbecause I don't want it to update a bunch of unnecessary gems and cause problems, hence why I read about--conservativea. I ran this anyway to test it, and it upgraded target gem to only 3.2.2 and 15 gems in total!
Solution 1:[1]
Remove the hydra-works gem from your Gemfile.
Either remove the gem and its dependencies by hand from the installed gem location or if you have the application in its own Ruby environment using rbenv or rvm run bundle clean --force.
Beware bundle clean --force will remove all of the gems in the Ruby version other than those specified in your Gemfile. If you have other applications that use the same version of Ruby you'll have to reinstall the gems for that application if they are different than what you are using in this application.
Add this to your Gemfile
gem 'hydra-derivatives', '~> 3.3.2'
gem 'hydra-works'
And run bundle install
You should see the correct dependency version now in your Gemfile.lock
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Preston |
