git Gemfile.lock 未签入 - Heroku

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4258327/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:46:33  来源:igfitidea点击:

Gemfile.lock not checked in - Heroku

ruby-on-railsgitherokubundler

提问by Ved

While trying to "git push heroku master", I keep getting the error :

在尝试“git push heroku master”时,我不断收到错误消息:

Counting objects: 266, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (239/239), done.
Writing objects: 100% (266/266), 222.68 KiB, done.
Total 266 (delta 55), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
       Unresolved dependencies detected; Installing...
       Using --without development:test
       You have modified your Gemfile in development but did not check
       the resulting snapshot (Gemfile.lock) into version control

       You have deleted from the Gemfile:
       * version: 1.0.6
       FAILED: http://docs.heroku.com/bundler
 !     Heroku push rejected, failed to install gems via Bundler

error: hooks/pre-receive exited with error code 1
To [email protected]:freezing-frost-65.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:freezing-frost-65.git'

I tried adding Gemfile and Gemfile.lock to git but to no avail. I tried removing .bundle directory and Gemfile.lock but the same error.

我尝试将 Gemfile 和 Gemfile.lock 添加到 git 但无济于事。我尝试删除 .bundle 目录和 Gemfile.lock 但同样的错误。

回答by Aditya Sanghi

There is a problem with bundler version 1.0.6 You need to run "gem update bundler" on your development machine to update bundler to 1.0.7. Then you need to run bundle update in your app to generate a new Gemfile.lock file. You will see that the Gemfile.lock is updated. Commit this new Gemfile.lock and push to heroku again.

bundler 版本 1.0.6 有问题 你需要在你的开发机器上运行“gem update bundler”来更新 bundler 到 1.0.7。然后你需要在你的应用中运行 bundle update 来生成一个新的 Gemfile.lock 文件。您将看到 Gemfile.lock 已更新。提交这个新的 Gemfile.lock 并再次推送到 heroku。

回答by jeremy wentworth

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

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

PLATFORMS
  x86-mingw32

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

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

回答by Simone Carletti

Both the Gemfileand Gemfile.lockfiles needs to be included in the git repository. Make sure you are not ignoring them in the .gitignorefile.

无论是GemfileGemfile.lock文件需要被包含在git仓库。确保您没有忽略.gitignore文件中的它们。

Also, make sure you are using Bundler >= 1.0.0 on your local machine to generate the Gemfile.lock. I you use an outdated version, such as Bundler 0.9x, it will fail.

另外,请确保您在本地计算机上使用 Bundler >= 1.0.0 来生成Gemfile.lock. 如果你使用过时的版本,比如 Bundler 0.9x,它会失败。

Last but not least, update your Gemfile.lock if you have one.

最后但并非最不重要的一点,如果您有 Gemfile.lock,请更新您的 Gemfile.lock。

$ cd /path/to/project
$ bundle update

回答by Rob Whelan

I deleted the "mingw" line under PLATFORMS on my Gemfile.lock file, added and committed to git, pushed it to git, then pushed everything to heroku and apparently it works now.

我删除了 Gemfile.lock 文件中 PLATFORMS 下的“mingw”行,添加并提交到 git,将其推送到 git,然后将所有内容推送到 heroku,显然它现在可以工作了。

回答by Michael Berman

In your applicaton directory, in the binsubdirectory modify the files

在您的应用程序目录中,在bin子目录中修改文件

bin/bundle 
bin/rails 
bin/rake 

Instead of

代替

'#!/usr/bin/env ruby.exe

must be

必须是

'#!/usr/bin/env ruby

(thanks to previous post)

(感谢之前的帖子)

Make sure there are no references to windows in the gemfile.lock - they can just be deleted.

确保 gemfile.lock 中没有对窗口的引用——它们可以被删除。

Then

然后

git push heroku master

If there are still problems use heroku logs(copying text to a text editor makes it easier to cut and paste for solutions).

如果仍然存在问题,请使用heroku logs(将文本复制到文本编辑器可以更轻松地剪切和粘贴解决方案)。