Gemfile.lock not checked in - Heroku - ruby-on-rails

While trying to "git push heroku master", I keep getting the error :
Counting objects: 266, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (239/239), done.
Writing objects: 100% (266/266), 222.68 KiB, done.
Total 266 (delta 55), reused 0 (delta 0)
-----> 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...
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 deleted from the Gemfile:
* version: 1.0.6
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:freezing-frost-65.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:freezing-frost-65.git'
I tried adding Gemfile and Gemfile.lock to git but to no avail. I tried removing .bundle directory and Gemfile.lock but the same error.

There is a problem with bundler version 1.0.6
You need to run "gem update bundler" on your development machine to update bundler to 1.0.7. Then you need to run bundle update in your app to generate a new Gemfile.lock file. You will see that the Gemfile.lock is updated. Commit this new Gemfile.lock and push to heroku again.

I fixed mine by opening Gemfile.lock and deleting the following two lines:
PLATFORMS
x86-mingw32
So now i just need to make a script that bundles then removes that from the lock file.

Both the Gemfile and Gemfile.lock files needs to be included in the git repository.
Make sure you are not ignoring them in the .gitignore file.
Also, make sure you are using Bundler >= 1.0.0 on your local machine to generate the Gemfile.lock. I you use an outdated version, such as Bundler 0.9x, it will fail.
Last but not least, update your Gemfile.lock if you have one.
$ cd /path/to/project
$ bundle update

Found the answer at - http://www.unityisplural.com/2010/11/hobo-finally.html

I deleted the "mingw" line under PLATFORMS on my Gemfile.lock file, added and committed to git, pushed it to git, then pushed everything to heroku and apparently it works now.

In your applicaton directory, in the bin subdirectory modify the files
bin/bundle
bin/rails
bin/rake
Instead of
'#!/usr/bin/env ruby.exe
must be
'#!/usr/bin/env ruby
(thanks to previous post)
Make sure there are no references to windows in the gemfile.lock - they can just be deleted.
Then
git push heroku master
If there are still problems use heroku logs (copying text to a text editor makes it easier to cut and paste for solutions).

Related

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

Error in Gemfile with heroku deploy

I'm reading this manual and when I try to deploy my first app git says:
-----> Heroku receiving push
-----> Ruby/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
Windows Gemfile.lock detected, ignoring it.
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:
* source: rubygems repository http://rubygems.org/
* rails (= 3.0.3)
* sqlite3 (= 1.3.3)
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
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'
Any solution?
Unfortunately, you can't deploy to Heroku very well from a Windows Rails installation.
It is telling you that you didn't commit the file right after saying it ignored the file, so the real question you're trying to answer is "why isn't Heroku accepting my Windows Gemfile.lock file?". Based on that, I'd have pulled out "Windows Gemfile.lock detected; ignoring it" and pasted that into google or here in Stack Overflow.
That would have lead you to this previous SO answer: Why won't Heroku accept my Gemfile.lock in Windows?

Deploying rails app on heroku

I'm learning RoR and trying to deploy my test app to heroku receiving next error:
Unresolved dependencies detected; Installing...
Using --without developmen
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.9.3.beta1)
* pg
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
Please! Help!
Have you committed your Gemfile.lock?
bundle install
git add Gemfile.lock
git commit -am "Add lock file"
git push heroku master
This error might be because you did not completely do bundle install.
First do
bundle install
Add gem 'pg' to the gem file and install the postgres gems and postgres on your local machine. If you dont want to install postgres on your local machine then add gem 'pg to production environment and run bundle install without test environment. Though heroku discourages this way of running your application. It is always better to use same database for running locally and in production. Installing postgres is pain but it is worth it.
Your ruby should be 1.9.2.
After installing all the dependencies and post gres on your machine do bundle install and add your gem file to heroku.
git add Gemfile
git add Gemfile.lock
git commit
git push heroku master

App failing to push to heroku because of gem bundler (Failed to add the host to the list of known hosts (/home/group_home/.ssh/known_hosts))

I had encountered this error when attempting to push a spree sandbox cart to test an extension I was going to use.
My Gemfile
gem 'spree_flexi_variants', :git=>'git#github.com:jsqu99/spree_flexi_variants.git', :branch => 'pre-deface-stable'
The output of heroku push:
julio#ubuntu:~/rails/sandboxcart $ git push heroku master
Counting objects: 502, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (475/475), done.
Writing objects: 100% (502/502), 2.63 MiB | 458 KiB/s, done.
Total 502 (delta 44), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/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/
Fetching git#github.com:jsqu99/spree_flexi_variants.git
Failed to add the host to the list of known hosts (/home/group_home/.ssh/known_hosts).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
An error has occurred in git when running `git clone "git#github.com:jsqu99/spree_flexi_variants.git" "/disk1/tmp/build_1s7xejrz2f9xk/.bundle/gems/ruby/1.9.1/cache/bundler/git/spree_flexi_variants-fc5500c20fdd64421924c0c5673538c7c6822540" --bare --no-hardlinks`. Cannot complete bundling.
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
The app runs and uses the gem properly but upon trying to deploy that error occurs. I am still in the process of trouble shooting but any help would be appreciated.
Do the following change:
gem 'spree_flexi_variants', :git=>'git#github.com:jsqu99/spree_flexi_variants.git', :branch => 'pre-deface-stable'
TO
gem 'spree_flexi_variants', :git=>"git://github.com/jsqu99/spree_flexi_variants.git", :branch => 'pre-deface-stable'
That should do it, and it has nothing to do with your heroku keys.
This looks like a problem with your SSH keys.
The Heroku Site has instructions on how to manage SSH keys.
Try heroku keys and make sure that you have configured that properly.

git push heroku master doesn't seem to work

I am following the guide on railstutorial.org. I get this error when I type the command on the title.
Counting objects: 66, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (52/52), done.
Writing objects: 100% (66/66), 86.47 KiB, done.
Total 66 (delta 3), reused 0 (delta 0)
-----> 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.0
Unresolved dependencies detected; Installing...
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:
* sqlite3-ruby (= 1.3.7)
You have deleted from the Gemfile:
* sqlite3-ruby (= 1.2.5)
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:morning-mountain-34.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:morning-mountain-34.git'
then when i type:
$ heroku open
I get a mountain site:http://morning-mountain-34.heroku.com/ which isn't supposed to be the case: should be first_app
found the solution:
first the problem occured possibly because of the so many mistakes I made earlier that I kept on closing the terminal.
so things were probably disabled. like "git init" "git add ." and "git commit -m" I don't really know which one but after doing all those and typing: git push heroku master.
It finally went through and when I type: heroku open. it still opens to morning-mountain-34 but it contains my first app now (which is nothing but its the one on the guide too :))

Resources