I'm having a lot of trouble deploying my code to Heroku.
I started by going to the Heroku logs. And, the photo is what was there.
enter image description here
So, I ran bundle install and got the error
An error occurred while installing pg (1.2.3), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'`
succeeds before bundling.
Eventually, I got that corrected. Just decided to work for some reason. Then, however, I started getting another error when trying to deploy. The error was:
remote: ! Failed to install gems via Bundler.
4:32
remote: ! Push rejected to brownsapp.
remote:
To https://git.heroku.com/brownsapp.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/brownsapp.git'
I then tried git push --force heroku. No dice. Then it came to thinking that it was trying to deploy from the wrong branch. But the main branch is the only branch I have. I checked and made sure. Noticed that the terminal also said
Warning - The same version of this code has already been built:
So, I ran git commit --allow-empty -m "Redeploying" trying to get the app deployed.
No dice. Then I noticed another error saying:
Your bundle only supports platforms ["x86_64-darwin-18"] but your local platform
remote: is x86_64-linux.`
So, I ran the command bundle lock --add-platform x86_64-linux
And then the error continued to show. I tried deleting the Gemfile.lock file. That didn't help either. I'm at a compete loss. Any help would be appreciated.
I fixed my problem by adding the linux platform to my bundler Gemfile.lock with this commande.
bundle lock --add-platform x86_64-linux
Perhaps you can add it manually. Look for platform in your Gemfile.lock,
see the picture here for help https://i.stack.imgur.com/PLpya.png
Related
I'm following the Hartl rails tutorial, figured I'd give ruby a go. Previously was able to deploy to heroku just fine. Started a new project, and right after I changed my gem file and used the "bundle update" command, I got this error message:
An error occurred while installing ruby_dep (1.2.0), and Bundler cannot continue.
I tried pushing to my heroku master branch and got this message:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
! [remote rejected] master -> master (pre-receive hook declined)
I updated my bundler, my version of ruby is up to date...no clue what's going on here. Any help?
You must either have ruby >= 2.2.5 or add the following gem to your gemfile
gem 'listen', '3.1.1' and then run
bundle install
Since I have ruby 2.2.4, I added the above gem to my gemfile , then ran bundle install
Everything works fine after this step. Enjoy.
Summary:
When pushing to my staging app, Heroku complains that bundle install failed and that I need to run bundle install elsewhere and version the resulting Gemfile.lock. The problem is that I've already done this and committed it.
How do I fix this?
Issue:
Due to some inherited awfulness at work, I had to debug and fix several things in production. Everything's working now, but this means our master branch is ahead of staging by 10+ commits, including some gem changes. I merged them and attempted to push to my staging app on Heroku.
However, I didn't run bundle install after merging in the changes (shame on me), so Heroku correctly complained.
To fix this, I ran the standard:
bundle install
git add Gemfile.lock
git commit -m "Updated gem bundle"
git push staging
However, Heroku is still complaining about Gemfile.lock:
Counting objects: 228, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (179/179), done.
Writing objects: 100% (192/192), 24.38 KiB | 0 bytes/s, done.
Total 192 (delta 127), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.2
remote: -----> Installing dependencies using bundler 1.11.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
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: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
remote: Bundler Output: 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: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
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 redacted-staging.
remote:
To https://git.heroku.com/redacted-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/redacted-staging.git'
Also:
Gemfile.lock is not in .gitignore
bundle install runs fine, and does not update any gems (as I've run it several times now).
To verify my sanity, I checked git status and git log to ensure I actually added and committed the changes; I'm apparently not crazy (though please correct me if i'm wrong).
To reiterate:
I have already run bundle install and added & committed Gemfile.lock
How do I fix this?
What am I missing?
Update:
I've tried
running bundle update which updated 26 gems; committing the new Gemfile.lock and pushing results in the same error.
Deleting and re-bundling produces an identical Gemfile.lock. Adding a newline and pushing results in the same error.
Removing Bundler's version info from Gemfile.lock and pushing results in the same error.
I even re-addded the ruby-drupal-hash gem, ran bundle install, and pushed the new Gemfile and Gemfile.lock files. Interestingly, the error message about me deleting ruby-drupal-hash persisted despite it being present again.
I assume that you are working locally on different OS then your server is, for example windows vs Unix.
In order to fix it you simply have to build it with the following flag:
bundle install --deployment
If this is not working as well, simply delete the .lock file and let it be generated again in the same flow as you did before with install/update
Yeah, trying to run bundle update or if it didn't work, I think this line it's look interesting:
remote: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
remote: Bundler Output: 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: You have deleted from the Gemfile:
remote: * ruby-drupal-hash
It seems it is complaining about ruby-drupal-hash being removed from Gemfile but Gemfile.lock not reflecting it.
You have deleted from the Gemfile:
remote: * ruby-drupal-hash
I would check the Gemfile and Gemfile.lock for that particular gem and see if that is the problem.
The answer was deceptively simple (of course):
git push staging staging:master
The issue was that I was on the staging branch and needed to update my Heroku staging server's master branch.
Shame on me for overlooking something so obvious!
... and shame on Heroku's decidedly unhelpful output.
For future internet explorers, I had a similar situation.
I had to change the version of a gem dependency, so I had to manually add "Execjs, '2.7.0'" to my gemfile, since another gem update had pulled it to 2.8.0 and that was causing an issue on Heroku.
Once I got the dependency updated, I removed the gem from the gemfile (while it remained in the gemfile.lock) and never did a bundle install to clean up the gemfile.lock When I tried to push to Heroku, it broke and I got the same error.
To fix, I ran bundle install on the master branch and then committed the new gemfile.lock and then pushed to Heroku and it deployed as expected.
VERY stressful morning for me! :-)
I'm trying to push my rails project to heroku bit when doing a git push heroku master bundler fails with the following message:
Bundler Output: Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Fetching git://github.com/justinfrench/formtastic.git
Fetching git://github.com/activerecord-hackery/ransack.git
Fetching git://github.com/gregbell/active_admin.git
Could not find jwt-0.1.12 in any of the sources
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:murmuring-mountain-9361.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:murmuring-mountain-9361.git'
It seems jwt is a dependency of one of my gems, but it installs fine on my local environment. I tried explicitly declaring gem 'jwt', '0.1.12' in my gemfile, which worked fine locally, but not on heroku and I tried deleting the Gemfile.lock and generating it again. I even tried deleting the app instance off heroku and creating it again.
The following gist is my gemfile: https://gist.github.com/anonymous/84d3fc00566e036729cd
I'm using this vagrant box for my dev environment: https://github.com/ejholmes/vagrant-heroku
If you updated your gems in the last few days then you would have gotten a faulty version that was yanked. It was re-released as 1.0.0 because it has a slightly different API. I'd recommend using 0.1.11 or switching to 1.0 ... thanks, and sorry!
You'll get this when versions of Gems you are using (via your Gemfile.lock) have been yanked from RubyGems.org and Heroku is trying to grab them when you deploy.
You can see that 0.1.12 of jwt has been yanked at http://rubygems.org/gems/jwt/versions. The thing to do would be to look at your Gemfile.lock to see which gem is declaring the dependency on 0.1.12 and then fork that gem and bump the version and then use your forked version. Or contact the Gem owner and gem them to bump the dependency.
Anyonw have any idea what's happening with the aws-sdk gem. I noticed this popped up in one of my applications today and it's effecting more then one now. I get the same error in all app's yet the link to the gem seems to be working.
On Heroku
Gem::RemoteFetcher::FetchError: bad response Not Found 404 (https://s3.amazonaws.com/production.s3.rubygems.org/gems/aws-sdk-1.19.0.gem)
An error occurred while installing aws-sdk (1.19.0), and Bundler cannot
continue.
Make sure that `gem install aws-sdk -v '1.19.0'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby/Rails app
And locally:
$ gem install aws-sdk
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (http://production.cf.rubygems.org/gems/aws-sdk-1.19.0.gem)
Thanks in advance.
Looks like a botched deploy of some kind, version 1.18.0 looks like it's available. 1.19.0 was released today, do you really need to be using that version? Did you do a bundle update across your whole application or something that may have forced all gems to update? Don't do that! :)
Might want to let them know: https://github.com/aws/aws-sdk-ruby
For the life of me I can not figure out how to fix this issue. I have looked around for the whole day and found simular issues but they all seem to be slightly different.
-----> Heroku receiving push
-----> Rails app detected
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Your Gemfile doesn't have any sources. You can add one with a line like 'source:rubygems'
Could not find rake-0.8.7 in any of the sources
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:smooth-wind-620.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:
Bundle install and bundle list both have rake listed.
Have you tried adding something like source 'http://rubygems.org' to the top of your Gemfile, or source :gemcutter? That's the first error I see heroku giving you and would be the first thing I would try to resolve.