9

I am trying to push a project to Heroku for the first time using git push heroku master. However, I end up getting the following error:

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

Running bundle lock --add-platform x86_64-linux in turn results in the following output:

[17052, #<Thread:0x000000015307bc60 run>, #<NameError: uninitialized constant Gem::Source

... followed by a hundred lines of different paths on my computer.

Does anyone know how to interpret and solve this kind of output?

Thank you very much for your help!

Sebastian
  • 145
  • 1
  • 7

3 Answers3

14

Are you using M1 Mac? if yes then which means the platform is arm64-darwin-20, but the production environment is not.

Try to run below two commands and that will add the two platforms in Gemfile.lock

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

rm -rf Gemfile.lock and run bundle install

LHH
  • 3,233
  • 1
  • 20
  • 27
  • Thanks for your response! Yes, I am using M1 Mac. By running `bundle lock --add-platform ruby` I still get a similarly looking output: [18529, #, # – Sebastian Mar 24 '22 at 12:12
  • Please try to remove your Gemfile.lock file with below command rm -rf Gemfile.lock and rerun bundle install – LHH Mar 24 '22 at 12:18
  • Followed your suggested steps but the problem still remains. Errors are the same as before. – Sebastian Mar 24 '22 at 12:54
  • It didn't work for me to remove the Gemfile.lock (that actually UNDOES the platform additions). It worked otherwise. – pixelearth Sep 26 '22 at 14:38
8

It's solved here too. FYI

  • bundle lock --add-platform ruby
  • bundle lock --add-platform x86_64-linux
antoniolulee
  • 990
  • 6
  • 6
0

The first answer in the following stack overflow thread did the job for me:

Rails uninitialized constant Bundler (NameError)

#remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# rebundle 
bundle install
Sebastian
  • 145
  • 1
  • 7