Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku: Gemfile.lock is required issue

I have the following issue:

I'm trying to deploy my project on heroku but after i run

git push heroku master

I get the following:

git push heroku master -f
Counting objects: 524, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (498/498), done.
Writing objects: 100% (524/524), 157.76 KiB, done.
Total 524 (delta 207), reused 62 (delta 2)
-----> Heroku receiving push 
-----> Ruby/Rails app detected
!
!     Gemfile.lock is required. Please run "bundle install" locally
!     and commit your Gemfile.lock.
!
!     Heroku push rejected, failed to compile Ruby/rails app
To [email protected]:*****.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:*****.git'

I have run bundle install and bundle update for several times, i tried to delete Gemfile.lock from the repository and from my filesystem. But i still get the same message. Can anyone tell me what am i doing wrong?

The branch i'm trying to push is cloned from master.

like image 526
roman Avatar asked Mar 07 '12 16:03

roman


People also ask

Is Gemfile lock automatically generated?

Gemfile. lock is automatically generated when you run bundle install or bundle update . It should never be edited manually.

Do I need Gemfile lock?

You can (and should) specify versions of gems in your Gemfile but without the Gemfile. lock being included in Git. Then nobody else will get to benefit from your work of checking that the updated Gems still work. You should check your Gemfile for updates frequently and bundle update where appropriate.

What is Gemfile and Gemfile lock?

The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile. lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.

What is bundled with in Gemfile lock?

lock file contains all the information about the gems that are currently installed. This file is created after we run the bundle install command. A Gemfile. lock has a list of the exact versions of the gems required for the application.


1 Answers

Few things

  1. Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)
  2. Just do bundle install on your local prompt.
  3. now place Gemfile.lock
    • git add . or you can add only Gemfile.lock with this git add Gemfile.lock
    • git commit -m "commit message here"
    • git push

Now do git push heroku it should work.

like image 190
AMIC MING Avatar answered Sep 28 '22 00:09

AMIC MING