0

I'm facing errors I can't handle while trying to deploy an app to Heroku (it's my first time).

# ERROR when I try to `git push heroku master`
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_e569680f858939ef8f1f8ef3e8902eff/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_e569680f858939ef8f1f8ef3e8902eff/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.1'
# heroku buildpacks
=== staging-det-music Buildpack URLs
1. heroku/nodejs
2. heroku/ruby
# Gemfile.lock
RUBY VERSION
   ruby 2.6.1p33

BUNDLED WITH
   2.0.1

I've tried several solutions, like:

  • running RAILS_ENV=production bundle exec rake assets:precompile (see here)

  • adding the RAILS_SERVE_STATIC_FILES key (same)

  • upgrade Ruby to 2.6.3 (see here, can't find 2.6.3 with rbenv nor rvm)

I believe it might be due to this issue. Am I concerned by this point ?

2) When using binstubs to run a command instead of bundle exec the wrong version of Bundler can get activated when using Ruby 2.6.x. This bug is reported to Ruby Core and will be fixed when Ruby 2.6.3 is released.

In the short term, the workaround is to ensure all commands in the Procfile and app.json are prefaced with bundle exec. For example:

web: bundle exec bin/rails server -p $PORT -e $RAILS_ENV

worker: bundle exec sidekiq -C config/sidekiq.yml

As a newbie I feel really lost, could anyone help me on this ?

Thanks for your time

SOLUTION: found here removing BUNDLED WITH and the following line in Gemfile.lock

Sumak
  • 927
  • 7
  • 21

1 Answers1

1

There are known issues with Bundler 2 on Heroku, including this one:

A Gemfile.lock that specifies bundler 2.0.2 does not work with bundler 2.0.1

If you attempt to deploy an app that uses bundler 2.0.2 onto the Heroku platform with bundler 2.0.1 you may get this error:

`find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

This is 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.

Upgrade Ruby to at least version 2.6.3 locally, update the ruby version in your Gemfile, bundle install, commit the changes, and redeploy.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257