为什么 Heroku 在 Windows 中不接受我的 Gemfile.lock?

发布于 2024-11-06 09:59:28 字数 541 浏览 1 评论 0原文

我有一个部署在 Heroku 上的 Rails 应用程序。我正在使用几台不同的机器,并且我注意到当我添加新的依赖项(以便重建 Gemfile.lock)并在家里的 Windows 计算机上执行 bundle install 时,推送到 Heroku 失败并出现以下错误:

   Unresolved dependencies detected; Installing...
   Windows Gemfile.lock detected, ignoring it.
   You have modified your Gemfile in development but did not check
   the resulting snapshot (Gemfile.lock) into version control
   ...

Gemfile.lock 处于版本控制之下,但 Heroku 似乎选择忽略它,因为它是在 Windows 中创建的,然后抱怨几秒钟后它丢失了。为什么会出现这种情况?我该如何解决它?

I have a rails application that I deploy on Heroku. I'm using several different machines, and I noticed that when I add new dependencies (so that Gemfile.lock is rebuilt) and do bundle install on my Windows computer at home, push to Heroku fails with the following error:

   Unresolved dependencies detected; Installing...
   Windows Gemfile.lock detected, ignoring it.
   You have modified your Gemfile in development but did not check
   the resulting snapshot (Gemfile.lock) into version control
   ...

Gemfile.lock IS under version control, but Heroku appearently chooses to ignore it since it's created in Windows, and then complains that it's missing seconds later. Why does this happen? And how can I solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

平生欢 2024-11-13 09:59:28

我通过打开 Gemfile.lock 并删除以下两行来修复我的问题:

PLATFORMS
  x86-mingw32

所以现在我只需要制作一个脚本来捆绑然后从锁定文件中删除它。

I fixed mine by opening Gemfile.lock and deleting the following two lines:

PLATFORMS
  x86-mingw32

So now i just need to make a script that bundles then removes that from the lock file.

春花秋月 2024-11-13 09:59:28

就像上面评论的 matt 一样:

问题是 Bundler 为 Windows 创建了不同的 Gemfile.lock。唯一的解决方案是在 *NIX 系统上创建并提交锁定文件。

我建议创建一个运行例如 Ubuntu 的虚拟机 - 可能使用 Virtual Box 。您甚至可以获得现成的虚拟机 - 例如此处

Like matt commented above:

The problem is that Bundler creates different Gemfile.locks for Windows. The only solution is to create and commit the lock file on a *NIX system.

I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.

沉溺在你眼里的海 2024-11-13 09:59:28

来自 Heroku 文档

如果 Gemfile 的平台部分包含 Windows 条目,
例如 mswinmingw,那么 Gemfile.lock 文件将被忽略。

From the Heroku Docs:

If the platforms section of your Gemfile contains Windows entries,
such as mswin or mingw, then the Gemfile.lock file will be ignored.

噩梦成真你也成魔 2024-11-13 09:59:28

刚刚与这个问题斗争了一段时间。

我将 gemfile 修剪回 Rails,但问题仍然存在。然后,想到今天 Heroku 要求更新 heroku gem,我仔细研究了 heroku 的变化。

看来 1.9.2 ruby​​“bamboo”堆栈现在是默认堆栈 - 我的应用程序仍在 1.8.7 堆栈上运行。所以我运行了“heroku stack:migrateamboa-mri-1.9.2”并将堆栈更新到1.9.2 - 这不是我想做的事情,但你知道吗,它解决了上面的问题。

当然,我不想使用 1.9.2 堆栈,因此我迁移回 1.8.7 堆栈,并且再次正确安装。所以我认为这是一种解决方法 - 可能是一个过于复杂的方法 - 但它似乎“刷新”了 Heroku 端的任何错误。由于我在本地所做的任何事情(并且我尝试了 StackOverflow 文章中的很多内容)都没有任何效果,因此推送一直失败,如上所述。

所以是的,这解决了它。也不需要太长时间。但怀疑更多了解 Heroku 的开发人员可能会发现更好的解决方法!

Just battled through this problem for a while.

I trimmed my gemfile back to just rails and still had the issue. Then, thinking that heroku had demanded an update of the heroku gem today, I looked closer at heroku changes.

It seems the 1.9.2 ruby "bamboo" stack is now the default one - my app is still running on the 1.8.7 stack. So I ran "heroku stack:migrate bamboo-mri-1.9.2" and updated the stack to 1.9.2 - not something I wanted to do, but you know what, it fixed the issue above.

Of course, I didn't want to be on the 1.9.2 stack, so I migrated back down to the 1.8.7 stack, and things installed correctly again. So I think this is a workaround - and probably an overly complex one - but it seemed to "flush" whatever the error was heroku-side. As nothing I did locally (and I tried a LOT of things from StackOverflow articles) had any effect, the push just kept failing as above.

So yeah, this fixes it. Doesn't take too long either. But suspect a better workaround may be spotted by more heroku-knowledgeable developers !

梦魇绽荼蘼 2024-11-13 09:59:28

确保在安装捆绑包后提交Gemfile.lock 的更改。在您下次 push 到 Heroku 时,新的 gems 应该会正确安装。

Make sure you commit the changes to Gemfile.lock after installing the bundle. On your next push to Heroku, the new gems should be installed correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文