Git Push Heroku Master error in rubyonrails - ruby-on-rails

First off there is a lot of other errors I am getting, but I want to start with the lead error.. Ok so i want to push my project to my heroku server. I am in my apps directory and i run
"git push heroku master" and this is what i get
Identity added: /Users/some_ayodele/.ssh/id_rsa (/Users/some_ayodele/.ssh/id_rsa)
Initializing repository, done.
Counting objects: 145, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (124/124), done.
Writing objects: 100% (145/145), 31.06 KiB, done.
Total 145 (delta 27), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.5.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Your Gemfile lists the gem pg (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem pg (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem jquery-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* carrierwave
* rmagick
* heroku
* git-rails
* hoe (~> 1.5.1)
* RedCloth
* i18n
You have deleted from the Gemfile:
* thin
Bundler Output: Your Gemfile lists the gem pg (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem pg (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem jquery-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* carrierwave
* rmagick
* heroku
* git-rails
* hoe (~> 1.5.1)
* RedCloth
* i18n
You have deleted from the Gemfile:
* thin
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:desolate-temple-6370.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:desolate-temple-6370.git'

First of all, I think Postgres is the issue here. I believe Heroku and Rails builtin PG causes some issue. Try editing your gem page like this:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
Then, do "bundle install".
If this doesn't work try doing "bundle install --without production"
Hope this helps.

Related

Install local gems via bundle on heroku not working

I'm trying to install my app to heroku. But I'm having an issue with a gem. Its a private gem and we don't have a private gem server setup, so I've cloned the gem locally as a submodule inside the app.
When I push to heroku I get this error:
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: Ruby,Node.js
See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.1
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
The gemspecs for path gems changed
Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
The gemspecs for path gems changed
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app.
! Push failed
When I removed the locally install gem it all worked fine.
So strong hunch is that bundler 1.15.2 handles local gems differently and it's causing a conflict.
In my Gemfile, not inside any group, I have gem 'portkey', path: './gems/portkey/'
At the top of my Gemfile.lock I have
PATH
remote: gems/portkey
specs:
portkey (0.1.10)
bitly
omniauth-google-oauth2 (~> 0.5.3)
rails (~> 5.2.1)
rebrandly
shortener (~> 0.8.0)
will_paginate
Heroku doesn't support bundler 1.16.2 yet afaik
I'm using rails 5/ruby-2.5 and I don't seem be able to downgrade bundler to 1.15.2 and generate an older version of the lockfile
I can't easily make this gem accessible any other way.
I'm stumped how I can make the install of this gem work, and suggestions would be greatly appreciated.
Had a similar issue, solved by upgrading to Bundler 2.0.1 (which is now supported by Heroku).
For 1.x version they still use 1.15.2 though.

Cannot push to Heroku (gemfile.lock issue)

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! :-)

"sqlite3.h" missing when pushing Rails app to Heroku

I'm following this tutorial, but it fails when I try to push to Heroku. It seems "sqlite3.h" is missing. I'm new to development so I'm not sure what information will help people diagnose the problem, so here's everything :). I'm running on Mac OS X 10.7 Lion. Here are the versions of everything I'm working with:
Amits-MacBook-Air-2:demo_app amitgupta$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
Amits-MacBook-Air-2:demo_app amitgupta$ rails -v
Rails 3.2.3
Amits-MacBook-Air-2:demo_app amitgupta$ sqlite3 -version
3.7.11 2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669
Amits-MacBook-Air-2:demo_app amitgupta$ heroku -v
2.25.0
Amits-MacBook-Air-2:demo_app amitgupta$ port -v
MacPorts 2.0.4
Entering interactive mode... ("help" for help, "quit" to quit)
[RailsApps/demo_app] > quit
Goodbye
When I try to push to Heroku:
Amits-MacBook-Air-2:demo_app amitgupta$ heroku create --stack cedar
Creating floating-stream-8009... done, stack is cedar
http://floating-stream-8009.herokuapp.com/ | git#heroku.com:floating-stream-8009.git
Amits-MacBook-Air-2:demo_app amitgupta$ git push heroku master
Here's what I get:
Counting objects: 119, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (104/104), done.
Writing objects: 100% (119/119), 33.74 KiB, done.
Total 119 (delta 17), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.2
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Installing rake (0.9.2.2)
.
.
.
Installing sqlite3 (1.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
.
.
.
--disable-local
Gem files will remain installed in /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:blazing-mountain-3659.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:blazing-mountain-3659.git'
When I do:
Amits-MacBook-Air-2:demo_app amitgupta$ sudo port install sqlite3 +universal
I get:
Password:
---> Computing dependencies for sqlite3
---> Cleaning sqlite3
Next I tried:
Amits-MacBook-Air-2:demo_app amitgupta$ sudo gem install sqlite3 -v '1.3.6'
And get:
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.6
1 gem installed
Installing ri documentation for sqlite3-1.3.6...
Installing RDoc documentation for sqlite3-1.3.6...
Then:
Amits-MacBook-Air-2:demo_app amitgupta$ bundle install
gives:
Using rake (0.9.2.2)
.
.
.
Using sqlite3 (1.3.6)
Using uglifier (1.2.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Then I try pushing to Heroku again, but get the same problem. Perhaps it has something to do with the discrepancy between the first command "Creating floating-stream-8009" and the second command "failed to push some refs to 'git#heroku.com:blazing-mountain-3659.git'"?
gem 'sqlite3', :group => [:development, :test]
group :production do
gem 'pg'
end
edit Gemfile as above
remove Gemfile.lock
run bundle install --without production
git add .
git commit -am "bundle updating sqlite3"
git push heroku master
Heroku uses postgresql so you want to remove sqlite3 or move it into a development group in your Gemfile.
Check you Gemfile.lock for any other gems that may have dependencies on sqlite3, as this can also cause problems.
I had a similar problem and I wasn't even using sqlite3 for anything but after removing it from the gem file I still got that error
what solved it for me was a commit command
git commit -am
that I found on this tutorial
What happened to me was, I was following along the Heroku tutorial and when I used git push heroku master it was pushing from my latest Git commit (obviously!)
What I forgot was that in the eyes of Git, I was still using sqlite in the gemfile! Silly me!
So I used git add . followed by a git commit -m "Changed to Postgres." so Git knew about these changes. Pushing after that worked fine for me.
Yes, as these answers suggest, most of the time you will want to avoid using SQLite in production due to the constraints of the Heroku platform. However, you may have a perfectly acceptable use case (ex. read-only config) for using SQLite anyway. My recommendation is to:
Add the heroku-buildpack-apt buildpack
Add to your Aptfile:
libsqlite3-dev
libsqlite3-0

Cant seem to push to Heroku

I am working with a rails app and I can't seem to be able to push my app to Heroku. I have set up everything and use git but everytime I push it to heroku I get this:
Unresolved dependencies detected; Installing...
Using --without development:test
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* therubyracer (>= 0.8.2)
* libnotify
* rb-inotify
You have deleted from the Gemfile:
* growl
* rb-fsevent
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
I have noticed that my version of gem is 1.0.11 but the heroku push is using running Bundler version 1.0.7. I dont know if this makes a difference but I don't know how to go back to an older version.
Thanks for any help.
It looks like you failed to add your Gemfile.lock into the git repo for heroku.
Make sure it's not in your .gitignore, then:
git add Gemfile.lock
git commit -m "Adding Gemfile.lock"
If you have therubyracer in your Gemfile are you using Rails 3.1? You would be much better off running on the Cedar stack as opposed to the Bamboo stack. Cedar does not require the rubyracer gem to be in your gemfile. Bundler version doesn't matter in this case, 1.0.11 is used on Cedar whilst 1.0.7 is used on Bamboo but that's all managed by Heroku.

Heroku Push Error: "sprockets-2.0.0.beta.2 in any of the sources"

I'm tryting to push my RoR 3.1.0.beta1 project up to Heroku from my Git repository using the following command as usual:
git push heroku master
But I am getting the following error:
-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> 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
Fetching source index for http://rubygems.org/
Could not find sprockets-2.0.0.beta.2 in any of the sources
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
My Gemfile has this line:
gem 'sprockets', '2.0.0.beta.2'
Sprockets version 2.0.0.beta.2 exists because I've been pulling different versions including this version. Is there something I'm missing here?
Thanks
Looks like this version has been pulled from Rubygems, only beta.12 and beta.13 are listed:
http://rubygems.org/gems/sprockets
So you'd need to get the specific beta.2 branch from the repo, as Thariq suggests.
BUT, I'd probably go for one of the versions listed on rubygems - there must be good a reason why they were pulled ;)
It's not on rubygems because:
You need to figure out what source you are getting the gem from and add that to the top of your gem file like so:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3'
gem 'sprockets', '2.0.0.beta.2'
gem "sprockets", "~> 1.0.2" is on ruby gems. But you will need to find where your versions is specifically hosted such as http://mysite.org add that to the top of your gemfile.
Presumably you've been pulling from the Sprockets Git Repo. You need to tell your Gemfile where you get a gem that's not in rubygems, so in this case you would use:
gem 'sprockets', '2.0.0.beta.2', :git => 'git://github.com/sstephenson/sprockets.git'

Resources