Heroku push rejected, failed to install gems via Bundler

I don't think it's a Rails version problem, nor is it specific to Heroku. (I hit the same problem today, when running bundle install on my local development machine, with Rails 3.0.3.)

Running bundle update locally, as Andrew suggested, fixes the issue.

Edit: As suggested in the comments: remember to git add ., git commit -m "message"


I have same issue: remote: ! Failed to install gems via Bundler.

if you see the problem is this:

remote:  Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform
remote:  is x86_64-linux. Add the current platform to the lockfile with `bundle  loc
remote:  --add-platform x86_64-linux` and try again.

its mean this :

Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform is x86_64-linux. Add the current platform to the lockfile with `bundle loc --add-platform x86_64-linux` and try again.

If you see in your gemfile.loc you only have this :

PLATFORMS
  x86_64-darwin-16

So I did this command, To add in your platform in gemfile.loc

bundle lock --add-platform x86_64-linux

This will update your Gemfile.loc :

PLATFORMS
  x86_64-darwin-16
  x86_64-linux

Continue :

git add .
git commit -m "add platform x86_64-linux"

Push again

git push heroku master:main

Solve!


I solved this issue this way:

  1. bundle update
  2. git add Gemfile.lock
  3. git commit -m 'Update Gemfile.lock for Heroku'
  4. git push heroku master

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux
bundle install
git add .
git commit -m "Bundler fix"

Use:

rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock

I had Gemfile.lock at my localserver make sure to delete it from the localserver AND also the HEROKU V-machine.