Heroku:由于 gem 安装捆绑程序,无法推送到 Heroku

Heroku: Cannot push to Heroku due to gem install bundler

突然间我无法推送到 Heroku 并且我到达了构建成功的地步,但是在编译时我看到以下内容:

remote: -----> Build succeeded!
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: sh: 1: gem-install-bundler: not found
remote: sh: 1: gem-install-bundler: not found
remote:  !
remote:  !     An error occurred while installing ruby-2.2.3-The-latest-bundler-is-1.15.2,-but-you-are-currently-running-1.15.1.-To-update,-run-`gem-install-bundler`
remote:  !     
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !     
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !     
remote:  !     
remote:  !     Debug InformationCommand: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/cedar-14/ruby-2.2.3-The-latest-bundler-is-1.15.2,-but-you-are-currently-running-1.15.1.-To-update,-run-`gem-install-bundler`.tgz -s -o - | tar zxf - ' failed unexpectedly:
remote:  !     bash: gem-install-bundler: command not found
remote:  !     
remote:  !     gzip: stdin: unexpected end of file
remote:  !     tar: Child returned status 1
remote:  !     tar: Error is not recoverable: exiting now
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed

据我所知,我想我需要更新 bundler,所以我将 bundler 更新到版本 1.15.2,并尝试再次推送它,但显示相同的错误。我的 gemfile.lock 甚至说 BUNDLED WITH 1.15.2.

有什么我遗漏的吗?

你是否将生成的 Gemfile.lock 检查到版本控制中

git add Gemfile.lock

我联系了 Heroku,他们告诉我我有多个构建包:

Thanks for contacting us regarding issue around installation of ruby. It seems that the app has Heroku Buildpack for Ruby specified twice, with the latter specifying the master version rather than the released version:

$ heroku buildpacks -a app-name
=== app-name Buildpack URLs
1. heroku/ruby
2. https://github.com/heroku/heroku-buildpack-nodejs.git
3. https://github.com/heroku/heroku-buildpack-ruby.git

然后他们继续向我展示如何解决问题:

Could you please try specifying each of buildpacks once as well as using the released versions to see if the problem pertists?

$ heroku buildpacks:remove -i 3 -a app-name
$ heroku buildpacks:remove -i 2 -a app-name
$ heroku buildpacks:remove -i 1 -a app-name
$ heroku buildpacks:add heroku/nodejs -a app-name
$ heroku buildpacks:add heroku/ruby -a app-name
$ git push heroku master

这一切都解决了!