Heroku error - Failed to install gems via Bundler - ruby-on-rails

I'm making a new deployment to heroku and getting the following error, any ideas on how to fix this? Is bundler broken?
remote: Downloading countries-1.2.5 revealed dependencies not in the API or the lockfile
remote: (i18n_data (~> 0.7.0)).
remote: Either installing with `--full-index` or running `bundle update countries`
remote: should fix the problem.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...

Due to the lack of context I'd try updating the gem and retrying, let us know if that works.

Related

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!
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
'

Heroku bundler undefined method "present?", fails to install gems via bundler

Encountered a weird error while trying to push the rails app to Heroku:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.16
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.0.1
remote: -----> Installing dependencies using bundler 2.2.16
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote: Bundler Output: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
Before that, I’ve deployed a scaffold of the app to Heroku and everything went fine. But after working some time and pushing changes that error appeared.
Have already tried regenerating Gemlock.file and bundle update but without luck. Locally, everything works fine. Ruby and bundler versions are the same locally and on Heroku. Now, don’t have a clue, what that could be. Have anyone encountered such an error?
Found a solution. The problem was that rubocop amended the 42 line in /bin/bundle file to return gemfile if gemfile.present?, which through the error. I just revert it to the initial state of return gemfile if gemfile && !gemfile.empty? and everything worked. Hope, that will help someone.

"Push rejected, failed to compile Ruby app" installation of decdim on herouku

I'm trying to install decidim (decidim.org) on herouku, I get this error when i make the deploy
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run bundle install elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The gemspecs for path gems changed
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
this is the end lines of the deploy.
anyone has an answer for this issue?
thanks
Go to the folder where you have your app and try typing the command: bundle install then try pushing to heroku afterwards.

Errors with "git push heroic master", what to do?

So i'm trying to deploy my rails app through heroku. But every time i run "git push heroic master", i run into this. I have searched around, but nothing seems to work. I have tried to "bundle update", "bundle install", but i still get this error when i run "git push heroic master"
Counting objects: 84, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (70/70), done.
Writing objects: 100% (84/84), 20.65 KiB | 1.88 MiB/s, done.
Total 84 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
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: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: The dependencies in your gemfile changed
remote: You have added to the Gemfile:
remote: * pg
remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The dependencies in your gemfile changed
remote:
remote: You have added to the Gemfile:
remote: * pg
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to secret-mesa-55611.
remote:
To https://git.heroku.com/******
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/*******.git'
It seems that your Gemfile.lock is changed. Try running bundle install after cleaning the Gemfile.lock

RoR Could not find fog-aws-0.7.0 in any of the sources

I have problem with heroku, when I try to push it, Could not find fog-aws-0.7.0 in any of the sources.
remote: Could not find fog-aws-0.7.0 in any of the sources
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to sample-app-kong.
remote:
To https://git.heroku.com/sample-app-kong.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sample-app-kong.git'
Version 0.7.0 of the fog-aws gem has been removed from the Rubygems server.
If you run bundle update fog-aws in your project folder, bundler will try to load the latest version of the gem instead, and then you'll be able to push to Heroku
Now I fix it run git push -f heroku

Resources