0

UPDATE: now using Ruby 2.5.5 and Bundler 2.0.2, still getting the error:

/app/tmp/buildpacks/<long hash>/lib/language_pack/helpers/rake_runner.rb:106:
in load_rake_tasks!': 
Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)` 

I'm trying to git push heroku master a Rails app for the first time, and I'm getting this error:

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_cf9981ccbdc1fd4f0b82703a5ff40ecc/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=vendor/bundle/ruby/2.5.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_cf9981ccbdc1fd4f0b82703a5ff40ecc/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=vendor/bundle/ruby/2.5.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 have run gem install bundler:2.0.1 successfully in this app's root directory. My $GEM_PATH does not include vendor/bundle/ruby/2, and I don't know if altering it is the solution. If so, does that mean I need to alter it locally or remotely? If locally, is it done the same way as normal environment variables, or is there a special Rails setting I need to change?

I have tried the suggestion in the accepted answer here:

heroku push error: "Could not detect rake tasks"

but that made no difference.

My problem also seems to be similar to the (unanswered) question here:

Can't Push Rails Project to Heroku

Searching the Heroku Help Center didn't seem to yield any results, either.

Any guidance about what I should do?

amp108
  • 432
  • 3
  • 14

1 Answers1

0

This is a known issue with Bundler 2 on Heroku:

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 version 2.5.5+ or 2.6.3+ locally, update your Gemfile accordingly, and re-run bundle. Commit the changes to your Gemfile and Gemfile.lock, then deploy again.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Chris: Thanks, but even after doing that, I still can't push to Heroku. It still complains about not being able to detect rake tasks, then runs what appears to be a series of rake tasks, then complains, after a 'rake yarn install' attempt, of an 'invalid option: -P', which I have never specified and don't know where it comes from. – amp108 Jul 27 '19 at 08:38
  • @amp108, I'm pretty sure this the problem. What version of Ruby is Heroku using when it tries to build your application? (For comparison, the output you show above shows `ruby/2.5.0`, which is a version affected by the issue I linked to.) – ChrisGPT was on strike Jul 27 '19 at 13:07
  • yes, I updated after asking the question, and now, even though the log says `remote: -----> Using Ruby version: ruby-2.5.5` and `remote: -----> Installing dependencies using bundler 2.0.2`, I'm still getting `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)` – amp108 Jul 27 '19 at 18:23
  • Please update your question with this new information, including more context for that error message. – ChrisGPT was on strike Jul 27 '19 at 22:08