Barbie Zoani Gray
Barbie Zoani Gray

Reputation: 35

Heroku Deploying: Failed to install gems via Bundler

While trying to deploy my app to heroku, I get this error:

remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:             Detected buildpacks: Ruby,Node.js
remote:             See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.10
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.5
remote: -----> Installing dependencies using bundler 2.3.10
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Your bundle only supports platforms ["x86_64-darwin-21"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with
remote:        `bundle lock --add-platform x86_64-linux` and try again.
remote:        Bundler Output: Your bundle only supports platforms ["x86_64-darwin-21"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with
remote:        `bundle lock --add-platform x86_64-linux` and try again.
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: b841b157d86386b34d46224f6f00301501c82b49
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version b841b157d86386b34d46224f6f00301501c82b49
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to radiant-citadel-26297.
remote: 
To https://git.heroku.com/radiant-citadel-26297.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/radiant-citadel-26297.git'

I have already tried bundle lock --add-platform x86_64-linux but didnt work. I have also tried to solve it with other methods, such as "bundle lock --add-platform ruby", with no success. Please help!

Upvotes: 0

Views: 501

Answers (1)

Barbie Zoani Gray
Barbie Zoani Gray

Reputation: 35

The problem I had was that I was did not added, commited and pushed. This solved the issue: ' bundle lock --add-platform x86_64-linux git add -A git commit -m 'Add platform' git push '

Upvotes: 1

Related Questions