Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.


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

remote: -----> Detecting rake tasks
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: !



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

remote: Verifying deploy... done.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away