Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add platform to Gemfile.lock using bundle lock

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!

like image 652
Sebastian Avatar asked Mar 04 '26 09:03

Sebastian


1 Answers

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

like image 93
LHH Avatar answered Mar 07 '26 15:03

LHH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!