[英]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.我正在尝试将 gem (
hydra-derivatives
) 升级到版本3.3.2以查看它是否解决了我们遇到的错误。
hydra-derivatives is not a Gemfile gem; hydra-derivatives不是Gemfile的 gem; it's bundled as a dependency of another gem, called
hydra-works
.它被捆绑为另一个名为
hydra-works
的 gem 的依赖项。
bundle update --conservative hydra-derivatives
but that only upgraded hydra-derivatives to 3.2.2 (& we want 3.3.2) and its dependency mini_magick
from 4.5.1 to 4.8.0 bundle update --conservative hydra-derivatives
但这只将 hydra-derivatives 升级到 3.2.2(我们想要 3.3.2)及其依赖mini_magick
从 4.5.1 到 4.8.0 adding gem 'hydra-derivatives', '~> 3.3.2'
but that gave me:添加
gem 'hydra-derivatives', '~> 3.3.2'
但这给了我:
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-derivatives
because I don't want it to update a bunch of unnecessary gems and cause problems, hence why I read about --conservative
我不想运行
bundle update hydra-derivatives
因为我不希望它更新一堆不必要的 gem 并导致问题,因此我阅读了--conservative
a.一个。 I ran this anyway to test it, and it upgraded target gem to only 3.2.2 and 15 gems in total!
无论如何我运行它来测试它,它将目标 gem 升级到只有 3.2.2 和总共 15 个 gem!
hydra-derivatives is not a Gemfile gem;
hydra-derivatives 不是 Gemfile 的 gem; it's bundled as a dependency of another gem, called hydra-works.
它被捆绑为另一个名为 hydra-works 的 gem 的依赖项。
You can still add this as an explicit dependency in your Gemfile:您仍然可以在 Gemfile 中将其添加为显式依赖项:
# only restrict the version if you know of an incompatibility
gem 'hydra-derivatives' , '~> 3.3'
then run然后运行
bundle update hydra-derivatives --conservative
or或者
bundle update hydra-works --conservative
Remove the hydra-works gem from your Gemfile.从您的 Gemfile 中删除 hydra-works gem。 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
.从已安装的 gem 位置手动删除 gem 及其依赖项,或者如果您在其自己的 Ruby 环境中使用
rbenv
或rvm
运行bundle clean --force
应用程序。
Beware bundle clean --force
will remove all of the gems in the Ruby version other than those specified in your Gemfile.注意
bundle clean --force
将删除 Ruby 版本中的所有 gem,而不是 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.如果您有其他应用程序使用相同版本的 Ruby,如果它们与您在此应用程序中使用的不同,则必须重新安装该应用程序的 gem。
Add this to your Gemfile将此添加到您的 Gemfile
gem 'hydra-derivatives', '~> 3.3.2'
gem 'hydra-works'
And run bundle install
并运行
bundle install
You should see the correct dependency version now in your Gemfile.lock您现在应该在 Gemfile.lock 中看到正确的依赖版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.