Heroku push error: "Your bundle is locked to mimemagic (0.3.5) from rubygems repository" AFTER update to Rails 6.1.3.2

Heroku push error: "Your bundle is locked to mimemagic (0.3.5) from rubygems repository" AFTER update to Rails 6.1.3.2

我在推送到 heroku 时一直收到此错误 Your bundle is locked to mimemagic (0.3.5) from rubygems repository

我读了 resolved issue on Github,其中 Rails 团队将对 ActiveStorage 的依赖从 mimemagic 换成了 mini_mime。所以我按照建议将我的应用程序从 Rails 6.0.3 升级到 6.1.3.2。我的 Gemfile 现在有 gem 'rails', '>=6.1.3.2'.

我 运行 bundle update 更新了所有的宝石,我做了一个 bundle uninstall mimemagic 作为很好的衡量标准。

我在 Gemfile.lock 中确认不再引用 mime_magic。相反,我可以看到 activestorage 更新了对 mini_mime:

的依赖
activestorage (6.1.3.2)
  actionpack (= 6.1.3.2)
  activejob (= 6.1.3.2)
  activerecord (= 6.1.3.2)
  activesupport (= 6.1.3.2)
  marcel (~> 1.0.0)
  mini_mime (~> 1.0.2)

所有更改都已在回购中提交。但是,当我通过 git push heroku main 部署到 Heroku 时,我仍然收到此 Your bundle is locked to mimemagic (0.3.5) from rubygems repository 错误。当所有的 gem 都被更新并且不再引用它,并且它不再存在于我的本地机器或 Gemfile.lock 中时,怎么会有依赖关系?

我正在将我现有的应用程序移植到 heroku,因此我创建了一个名为 heroku 的单独分支来进行更改。我想在 与我的主分支合并之前测试首次部署到 heroku

所以我 运行 $ git push heroku main 希望将我本地的 heroku 分支推送到 Heroku。相反,它正在推送我的主分支,该分支没有更新的 Rails gems。

经验教训,运行 $ git push heroku main 推送您的 main 分支,即使您当前在不同的分支上也是如此。

我进入了我的 Heroku 应用程序的设置,并从我的 heroku 分支的 Github 做了一个手册 build/deploy。已成功构建和部署应用程序。