LoginSignup
24
24

More than 3 years have passed since last update.

[memo] Herokuで Could not find 'bundler' (2.0.1) と言われた

Posted at

簡潔に言うと

Herokuに git push heroku masterしたときにbuildが失敗して次のようなエラーメッセージが表示されますが、エラーメッセージの通り確認してみてもちゃんとbundler 2.0.1がインストールされています。

remote: -----> Detecting rake tasks
remote:
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.1) failed:
remote: ! Could not find 'bundler' (2.0.1) required by your /tmp/build_94d6a4f5d4fbb862672998d5d06d2506/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.1
remote: ! Checked in 'GEM_PATH=/tmp/build_94d6a4f5d4fbb862672998d5d06d2506/vendor/bundle/ruby/2.7.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.1'
remote: !

あまり詳しく見ていないのですが、このstackoverflowの回答にあるように数日前からbuildが失敗するようになったとのことで、rubyとbundlerのバージョンを上げると直るようです。
https://stackoverflow.com/questions/56680065/heroku-installs-bundler-then-throws-error-bundler-2-0-1
気になる人は公式サイト読んでください。
https://devcenter.heroku.com/articles/bundler-version#bundler-2-0-2

rubyとbundlerのバージョンを上げる

幸いコードが軽かったため無邪気にバージョンを上げます。
mac + rbenv環境だと次のような感じになると思います。

$ brew update && brew upgrade ruby-build
$ rbenv install 2.6.3
$ rbenv local 2.6.3
$ gem install bundler -v 2.0.2
$ rm Gemfile.lock
$ bundle install
$ git add .ruby-version Gemfile Gemfile.lock
$ git commit -m 'version up ruby'
$ git push heroku master

これでdeployが成功しました😀
remote: Verifying deploy... done.

24
24
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
24
24