LoginSignup
4
3

More than 3 years have passed since last update.

[heroku] bundler 2.0+ をつかえるようにbuildpackをカスタムしていてpushが弾かれた話

Posted at

前提

Bundler gemが2.0にアップデートされたときに、アプリケーションもそのバージョンにアップしたけれど、herokuが内部で使用しているBundlerのバージョンが1.xxだったので、Bundler 2 系を使ったアプリを Heroku にデプロイする (You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)) - Qiitaのように、buildpackをカスタムしてheroku pushして運用していました。

(…何ヶ月か後)

問題: push heroku がリジェクトされる

そのことをすっかり忘れ、久しぶりにpush herokuすると、 bundlerがみつからないエラーがでました。

remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     Activating bundler (2.0.2) failed:
remote:  !     Could not find 'bundler' (2.0.2) required by your /tmp/build_2d0783040187f94af65f0eef9a2422a9/Gemfile.lock.
remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
remote:  !     To install the missing version, run `gem install bundler:2.0.2`
remote:  !     Checked in 'GEM_PATH=/tmp/build_2d0783040187f94af65f0eef9a2422a9/vendor/bundle/ruby/2.6.0', execute `gem env` for more information
remote:  !
remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.2'`
remote:  !

そうだbuildpackをカスタムしたぞ。と気づいて現在の状態を確認します。
bundlerの公式が提供していたbuildpackをつかうようになっていました。

$ heroku buildpacks
=== your-apps Buildpack URL
https://github.com/bundler/heroku-buildpack-bundler2.git

解決:buildpacks:set でデフォルトの状態にもどす

Bundler Version | Heroku Dev Centerを参考に、buildpacksを元の状態にもどします。

$ heroku buildpacks:set heroku/ruby
Buildpack set. Next release on your-apps will use heroku/ruby.
Run git push heroku master to create a new release using this buildpack.

$ heroku buildpacks
=== your-apps Buildpack URL
heroku/ruby

このあと、push herokuが正常に動作しました。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3