Cannot add platform to Gemfile.lock using bundle lock

7.9k Views Asked by At

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!

3

There are 3 best solutions below

0
On

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
4
On

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

1
On

It's solved here too. FYI

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