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!
CodePudding user response:
Are you suing 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
CodePudding user response:
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