简体   繁体   English

是否可以验证 Gemfile.lock 中的所有宝石是否存在于 https://rubygems.org?

[英]Is it possible to verify if all gems in a Gemfile.lock exist at https://rubygems.org?

Is it possible to verify if all gems in a Gemfile.lock file exist at https://rubygems.org ?是否可以验证Gemfile.lock文件中的所有 gem 是否存在于https://rubygems.org

I recently updated my elastic beanstalk platform version, and it failed due to the following error:我最近更新了我的弹性 beanstalk 平台版本,由于以下错误而失败:

Your bundle is locked to mimemagic (0.3.3), but that version could not be found in any of the sources listed in your Gemfile.您的捆绑包被锁定为 mimemagic (0.3.3),但在您的 Gemfile 中列出的任何源中都找不到该版本。 If you haven't changed sources, that means the author of mimemagic (0.3.3) has removed it.如果您没有更改来源,则意味着 mimemagic (0.3.3) 的作者已将其删除。 You'll need to update your bundle to a version other than mimemagic (0.3.3) that hasn't been removed in order to install.您需要将您的捆绑软件更新为 mimemagic (0.3.3) 以外的版本,该版本尚未删除才能安装。

It was difficult to debug due to all the complexities of a managed deploy system.由于托管部署系统的所有复杂性,调试起来很困难。

The reason it failed is that the author of mimemagic has removed version 0.3.3, and so I needed to update the gem to 0.3.6.失败的原因是mimemagic的作者已经删除了0.3.3版本,所以我需要将gem更新到0.3.6。 (see gem versions history here: https://rubygems.org/gems/mimemagic/versions ) (在此处查看 gem 版本历史记录: https://rubygems.org/gems/mimemagic/versions

So my question is: is there a command you can run, eg bundle check_sources that scans the gems and versions in your Gemfile.lock and hits https://rubygems.org to verify that they all exist and are still available?所以我的问题是:是否有可以运行的命令,例如bundle check_sources扫描 Gemfile.lock 中的 gem 和版本并点击Gemfile.lock ://rubygems.org以验证它们是否都存在并且仍然可用?

It would be similar to what bundle check does, but instead of looking for the gems on your local machine, it would look for them at the remote source.它类似于bundle check所做的,但不是在本地计算机上查找 gem,而是在远程源中查找它们。

After suggesting a feature request with the developers of bundler here: https://github.com/rubygems/rubygems/issues/4487 , they suggested at least a viable work-around.在向bundler的开发人员提出功能请求后: https://github.com/rubygems/rubygems/issues/4487 ,他们建议至少有一个可行的解决方法。 Simply run this command:只需运行以下命令:

bundle install --deployment --redownload

The --redownload (or --force ) switch will force the download of every gem, even if the required versions are already available locally. --redownload (或--force )开关将强制下载每个 gem,即使所需的版本已经在本地可用。

The --deployment switch forces the usage of the exact versions specified in your Gemfile (and ignore patch upgrades like ~> 0.3.2 which would normally upgrade to eg 0.3.6 ). --deployment开关强制使用您的 Gemfile 中指定的确切版本(并忽略补丁升级,如~> 0.3.2通常会升级到例如0.3.6 )。 The use of --deployment is common practice during deployments. --deployment的使用是部署期间的常见做法。

This solution isn't ideal since it requires a full reinstall of all your bundle's gems.此解决方案并不理想,因为它需要完全重新安装所有捆绑包的 gem。 But it works!但它有效!

Thanks to https://github.com/deivid-rodriguez for this suggestion.感谢https://github.com/deivid-rodriguez的建议。

i'm experienced the same exact issue today, im running my project on docker and the solution was to change the mimemagic version on the Gemfile.lock, i dont know if is an optimal solution but saved my day:)我今天遇到了同样的问题,我在 docker 上运行我的项目,解决方案是更改 Gemfile.lock 上的 mimemagic 版本,我不知道是否是最佳解决方案,但节省了我的一天:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM