[英]Cannot push to Heroku (gemfile.lock issue)
When pushing to my staging app, Heroku complains that bundle install
failed and that I need to run bundle install
elsewhere and version the resulting Gemfile.lock
. 当推送到我的登台应用程序时,Heroku抱怨bundle install
失败,并且我需要在其他地方运行bundle install
并对版本的Gemfile.lock
版本Gemfile.lock
。 The problem is that I've already done this and committed it. 问题是我已经完成并提交了。
How do I fix this? 我该如何解决?
Due to some inherited awfulness at work, I had to debug and fix several things in production. 由于工作中某些继承性的问题,我不得不调试和修复生产中的一些问题。 Everything's working now, but this means our master
branch is ahead of staging
by 10+ commits, including some gem changes. 一切的现在的工作,但是这也意味着我们的master
分支提前staging
通过10+提交,其中包括一些宝石的变化。 I merged them and attempted to push to my staging app on Heroku. 我合并了它们,并尝试将其推送到Heroku上的暂存应用程序。
However, I didn't run bundle install
after merging in the changes (shame on me), so Heroku correctly complained. 但是,合并更改后我没有运行bundle install
(这让我感到羞耻),因此Heroku正确地抱怨了。
To fix this, I ran the standard: 为了解决这个问题,我运行了标准:
bundle install
git add Gemfile.lock
git commit -m "Updated gem bundle"
git push staging
However, Heroku is still complaining about Gemfile.lock
: 但是,Heroku仍在抱怨Gemfile.lock
:
Counting objects: 228, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (179/179), done.
Writing objects: 100% (192/192), 24.38 KiB | 0 bytes/s, done.
Total 192 (delta 127), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.2
remote: -----> Installing dependencies using bundler 1.11.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
remote: Bundler Output: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to redacted-staging.
remote:
To https://git.heroku.com/redacted-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/redacted-staging.git'
Also: 也:
Gemfile.lock
is not in .gitignore
Gemfile.lock
不在 .gitignore
bundle install
runs fine, and does not update any gems (as I've run it several times now). bundle install
运行良好,并且不会更新任何gem(因为我已经运行了几次)。 git status
and git log
to ensure I actually added and committed the changes; 为了验证我的理智,我检查了git status
和git log
以确保我确实添加并提交了更改; I'm apparently not crazy (though please correct me if i'm wrong). 我显然并不疯(尽管如果我错了,请纠正我)。 I have already run
bundle install
and added & committedGemfile.lock
我已经运行bundle install
并添加并提交了Gemfile.lock
How do I fix this? 我该如何解决?
What am I missing? 我想念什么?
I've tried 我试过了
bundle update
which updated 26 gems; 运行bundle update
,更新了26个宝石; committing the new Gemfile.lock
and pushing results in the same error. 提交新的Gemfile.lock
并推送结果会导致相同的错误。 Gemfile.lock
. 删除并重新打包会生成相同的Gemfile.lock
。 Adding a newline and pushing results in the same error. 添加换行符并推送会导致相同的错误。 Gemfile.lock
and pushing results in the same error. 从Gemfile.lock
删除Bundler的版本信息并推送结果会导致相同的错误。 ruby-drupal-hash
gem, ran bundle install
, and pushed the new Gemfile
and Gemfile.lock
files. 我什至重新添加了ruby-drupal-hash
gem,运行bundle install
,并推送了新的Gemfile
和Gemfile.lock
文件。 Interestingly, the error message about me deleting ruby-drupal-hash
persisted despite it being present again. 有趣的是,尽管我再次删除了ruby-drupal-hash
但有关我的错误消息仍然存在。 I assume that you are working locally on different OS then your server is, for example windows vs Unix. 我假设您在本地使用的操作系统不同于服务器,例如Windows vs Unix。
In order to fix it you simply have to build it with the following flag: 为了修复它,您只需使用以下标志构建它:
bundle install --deployment
If this is not working as well, simply delete the .lock file and let it be generated again in the same flow as you did before with install/update 如果仍然无法正常工作,则只需删除.lock文件,然后以与安装/更新之前相同的流程重新生成该文件即可。
Yeah, trying to run bundle update
or if it didn't work, I think this line it's look interesting: 是的,尝试运行bundle update
或者如果它不起作用,我认为这一行看起来很有趣:
remote: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
remote: Bundler Output: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
It seems it is complaining about ruby-drupal-hash being removed from Gemfile but Gemfile.lock not reflecting it. 似乎有人抱怨ruby-drupal-hash已从Gemfile中删除,但Gemfile.lock没有反映出来。
You have deleted from the Gemfile:
remote: * ruby-drupal-hash
I would check the Gemfile and Gemfile.lock for that particular gem and see if that is the problem. 我将检查该特定gem的Gemfile和Gemfile.lock,看看是否是问题所在。
The answer was deceptively simple (of course): 答案看似简单(当然):
git push staging staging:master
The issue was that I was on the staging
branch and needed to update my Heroku staging server's master
branch. 问题是我在staging
分支上,需要更新我的Heroku登台服务器的master
分支。
Shame on me for overlooking something so obvious! 忽略这么明显的事情让我感到羞耻! ... and shame on Heroku's decidedly unhelpful output. ...和Heroku的断然无益输出耻辱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.