Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku installs Bundler then throws error Bundler 2.0.1

I'm attempting to deploy a Rails app to Heroku. It's been a while since I deployed anything there, but I'm at a loss for what's going on here.

It's a fairly basic Rails 5 application. Deployment goes through the Gemfile smoothly then fails with an error requesting that I install Bundler v 2.0.1. Here's the fun bit of the log:

remote:        Fetching devise 4.6.2
remote:        Installing sass-rails 5.0.7
remote:        Installing devise 4.6.2
remote:        Bundle complete! 26 Gemfile dependencies, 78 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Post-install message from i18n:
remote:        
remote:        HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
remote:        But that may break your application.
remote:        
remote:        Please check your Rails app for 'config.i18n.fallbacks = true'.
remote:        If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
remote:        'config.i18n.fallbacks = [I18n.default_locale]'.
remote:        If not, fallbacks will be broken in your app by I18n 1.1.x.
remote:        
remote:        For more info see:
remote:        https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
remote:        
remote:        Post-install message from sass:
remote:        
remote:        Ruby Sass has reached end-of-life and should no longer be used.
remote:        
remote:        * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
remote:          primary implementation: https://sass-lang.com/install
remote:        
remote:        * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
remote:          sassc gem: https://github.com/sass/sassc-ruby#readme
remote:        
remote:        * For more details, please refer to the Sass blog:
remote:          https://sass-lang.com/blog/posts/7828841
remote:        
remote:        Removing bundler (2.0.1)
remote:        Bundle completed (47.21s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v10.14.1-linux-x64
remote:        Detected manifest file, assuming assets were compiled locally
remote: -----> Detecting rails configuration
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:  !
remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
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'`

I don't understand what's going on as Heroku seems to be running through the deployment just fine, then removes bundler, then throws an error on rake tasks and asks for bundler again. I've performed RAILS_ENV=production bundle exec rake assets:precompile already, and it's showing up to date. I must be missing something here, hopefully someone with more recent experience in Heroku can point it out.

Edit I've run the bundle exec rake -P command as well with no failures

like image 974
PSCampbell Avatar asked Jun 20 '19 06:06

PSCampbell


People also ask

What version of bundler does heroku use?

It is fixed in 2.5. 5+ and 2.6. 3+. If you do not update, your Ruby version then every new release of Bundler 2.

How do I install bundler 2?

Installing Bundler 2 The first step in upgrading to Bundler 2 is installing the Bundler 2 gem. To install it the usual way, run gem install bundler and RubyGems will install the latest version of Bundler.


2 Answers

Most likely, all you need to run to fix this is

gem install bundler -v 2.0.2
bundle update --bundler

Commit those changes that it made in your Gemfile.lock, and then your next Heroku push will go through without a problem.

like image 123
gk12345 Avatar answered Sep 20 '22 02:09

gk12345


I fixed our builds on Heroku by upgrading to Ruby 2.6.3 and Bundler 2.0.2.

Our builds on Heroku started breaking in the last couple of days with a similar error message:

Could not find 'bundler' (2.0.1) required by your ... Gemfile.lock.

We were on Ruby 2.6.1 and Bundler 2.0.1 on our local builds which worked fine. This combo worked fine on Heroku up until a couple of days ago, too.

While sleuthing around the Heroku docs, I noticed this Dev Center article, which was updated on 26 June, 2019. It states:

Bundler 2.0.2 See issues for 2.0.1.

Many people are hitting issue 4 which is only triggered when a new Bundler version is released. It happens because of a bug in Rubygems, and can be fixed by upgrading to 2.5.5+ or 2.6.3+.

Issue 4 under 2.0.1 states:

[You may get an error] due to a bug in the Rubygems bundler version checking code. To avoid this issue, upgrade your Ruby version. It is fixed in 2.5.5+ and 2.6.3+. If you do not update, your Ruby version then every new release of Bundler 2.x will trigger this issue.

Bundler 2.0.2 was released 13 June, 2019 and it looks like Heroku has started using it.

I notice you are using Ruby 2.7 from your logs. I would suggest specifying ruby '2.6.3' in your Gemfile, installing Bundler 2.0.2, and bundling/generating your Gemfile.lock with that combination. You should then see this at the bottom of your lock file and hopefully your app builds successfully on Heroku:

RUBY VERSION
   ruby 2.6.3p62

BUNDLED WITH
   2.0.2
like image 43
tsamb Avatar answered Sep 20 '22 02:09

tsamb