您的捆绑包被锁定为 mimemagic (0.3.5),但在您的 Gemfile 中列出的任何源中都找不到该版本 [重复]

Posted

技术标签:

【中文标题】您的捆绑包被锁定为 mimemagic (0.3.5),但在您的 Gemfile 中列出的任何源中都找不到该版本 [重复]【英文标题】:Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile [duplicate] 【发布时间】:2021-06-29 08:04:38 【问题描述】:

今天我尝试为我的 rails 6.1.0 构建一个带有活动存储的 docker,我收到以下错误:

Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.5) has removed it. You'll need to update your
bundle to a version other than mimemagic (0.3.5) that hasn't been removed in order to install.

现在我尝试安装 mimemagic

 gem install mimemagic -v 0.3.5

我遇到以下错误:

ERROR:  Could not find a valid gem 'mimemagic' (= 0.3.5) in any repository
ERROR:  Possible alternatives: mimemagic

好像宝石不见了。有人可以解释一下吗?

有什么办法可以解决这个问题?

【问题讨论】:

删除 Gemfile.lock 并重新运行 bundle install 对我来说效果很好 你也可以查看这个链接exerror.com/…;有 4 种解决方案可用于解决此错误。 【参考方案1】:

几天前,模仿魔法的版本被撤掉了。更多信息请访问:

https://github.com/rails/rails/issues/41750 https://rubygems.org/gems/mimemagic/versions

您可以如下修改您的 Gemfile:

gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'

【讨论】:

这个答案应该被接受:它可以工作,提供修复的语法、根本原因的解释和背景上下文的链接。干得好 其实解决办法就是去掉mimemagic依赖,更新gem。由于 GPL 2 许可证,Rails 不再使用 mimemagic。 gem 'mimemagic', '~> 0.3.10' 也为我工作。 Rails 5.2.5、6.0.3.6 和 6.1.3.1 已经发布,移除了 mimemagic 依赖 不确定这个答案的创建时间,但我相信现在有比链接到特定提交更好的方法。我升级到mimemagic-0.4.3,但0.3.70.3.80.3.90.3.10 也应该可以工作。【参考方案2】:

尝试删除 Gemfile.lock 并再次捆绑。确保您可以真正做到这一点,因为您的所有宝石都将被更新。在我的 Rails 6.1 实例中,不再使用 mimemagic。完成。

如果这不可能,您需要更新 mimemagic,因为他们似乎删除了 0.3.7 以下的所有版本:bundle update mimemagic

更新:我不确定是否清楚,但 rails 不再使用 mimemagic。

【讨论】:

【参考方案3】:

如果您使用的是 macOS

brew install shared-mime-info
bundle update mimemagic

【讨论】:

没有解释原因,但需要shared-mime-info 来修复与本机扩展相关的任何更新失败。 试过brew install shared-mime-info 但这是一个相当长的安装操作。我建议阅读这篇文章,然后升级和删除依赖项......weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases

以上是关于您的捆绑包被锁定为 mimemagic (0.3.5),但在您的 Gemfile 中列出的任何源中都找不到该版本 [重复]的主要内容,如果未能解决你的问题,请参考以下文章

手机网络锁。怎么解决?

使用 Ionic / ngCordova 将相机/屏幕方向锁定为横向

ion.rangeSlider 将滑块锁定为预定义值

在 ios 应用程序中将 UIImagePickerController 锁定为纵向模式

iPad:仅将 UIView 方向锁定为横向模式

将 iPad 锁定为横向