Heroku push rejected, failed to install gems via Bundler
I am struggling to push my code to Heroku. And after searching on Google and Stack Overflow question开发者_StackOverflow社区s, I have not been able to find the solution. Here is What I get when I try "git push heroku master" :
Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
Unresolved dependencies detected; Installing...
Fetching source index for http://rubygems.org/
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:300:in `open_uri_or_path': bad response Not Found 404 (http://rubygems.org/quick/Marshal.4.8/mail-2.2.6.001.gemspec.rz) (Gem::RemoteFetcher::FetchError)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:172:in `fetch_path'
.
....
And finally:
FAILED: http://docs.heroku.com/bundler
! Heroku push rejected, failed to install gems via Bundler
error: hooks/pre-receive exited with error code 1
To git@heroku.com:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:myapp.git'
Thanks for your help!
I have same issue: remote: ! Failed to install gems via Bundler.
if you see the problem is this:
remote: Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform
remote: is x86_64-linux. Add the current platform to the lockfile with `bundle loc
remote: --add-platform x86_64-linux` and try again.
its mean this :
Your bundle only supports platforms ["x86_64-darwin-16"] but your local platform is x86_64-linux. Add the current platform to the lockfile with `bundle loc --add-platform x86_64-linux` and try again.
If you see in your gemfile.loc you only have this :
PLATFORMS
x86_64-darwin-16
So I did this command, To add in your platform in gemfile.loc
bundle lock --add-platform x86_64-linux
This will update your Gemfile.loc :
PLATFORMS
x86_64-darwin-16
x86_64-linux
Continue :
git add .
git commit -m "add platform x86_64-linux"
Push again
git push heroku master:main
Solve!
I don't think it's a Rails version problem, nor is it specific to Heroku. (I hit the same problem today, when running bundle install
on my local development machine, with Rails 3.0.3.)
Running bundle update
locally, as Andrew suggested, fixes the issue.
Edit:
As suggested in the comments: remember to git add .
, git commit -m "message"
I solved this issue this way:
- bundle update
- git add Gemfile.lock
- git commit -m 'Update Gemfile.lock for Heroku'
- git push heroku master
bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux
bundle install
git add .
git commit -m "Bundler fix"
Another tip: Open your Gemfile.lock and check if this block exists:
PLATFORMS
x86_64-darwin-20
If it exists, run the following command:
bundle config force_ruby_platform true
Now, you must recreate the whole Gemfile.lock, because some gems can be builded just for MacOS. So, just remove the Gemfile.lock
and run bundle install
(do no forget to stop spring, if it's running, otherwise spring automatically recreates the Gemfile.lock file)
Use:
rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock
I had Gemfile.lock
at my localserver
make sure to delete it from the localserver AND also the HEROKU V-machine.
- bundle update
- git add Gemfile.lock
- git commit -m 'Update Gemfile.lock for Heroku'
- git push heroku master
it worked for me.
Run: bundle lock --add-platform x86_64-linux
- bundle update
- git add Gemfile.lock
- git commit -m 'Update Gemfile.lock for Heroku'
- git push heroku master
I'm pretty sure Heroku only supports certain versions of Rails, so you need to be on at least 3.0, instead of a release candidate. Update the version of Rails in your gemfile, run bundle update
, and then try to push to Heroku.
I get the same - 404:
curl -v -I http://rubygems.org/quick/Marshal.4.8/mail-2.2.6.001.gemspec.rz
In your Gemfile you could try specifying a lower version number of this gem? 2.2.5 perhaps?
I actually solved it by simply pushing it up a second time after letting things sit for a few minutes... I have re-spun my dokku system from scratch and encountered the same issue, on the same day after I had previously attempted a workaround of updating nokogiri. That was when I realized, this seems to be an oddity of herokuish; it doesn't always take on the first push.
I wonder if behind the scenes it's installing library headers, and when they take too long, bundler simply fails the install.
My problem was about pg gem.
After installing postgres with 'brew install postgres' bundling finished.
Then doing commands Dyo Medio described, I managed to deploy the app on Heroku.
I was able to overcome this very issue today by purging the cache with steps (and was told it has to be done with each deployment until the bug is found and squashed): First install the plugin:
heroku plugins:install heroku-builds
Then use the following command to clear the cache:
heroku builds:cache:purge -a example-app
The cache will be rebuilt on the next deploy. If you do not have any new code to deploy, you can push an empty commit.
$ git commit --allow-empty -m "Purge cache"
$ git push heroku master
Where example-app is replaced by the name of the app you want to clear the cache for.
精彩评论