Aen Tan
Aen Tan

Reputation: 3345

Failed to push to Heroku. Don't understand what's wrong

Output:

Counting objects: 96, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (73/73), done.
Writing objects: 100% (73/73), 7.87 KiB | 0 bytes/s, done.
Total 73 (delta 56), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
       Fixing nokogiri install. Clearing bundler cache.
       See https://github.com/sparklemotion/nokogiri/issues/923.
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       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:
       * postmark-rails (~> 0.5.2)
       You have deleted from the Gemfile:
       * postmark-rails
       Bundler Output: 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:
       * postmark-rails (~> 0.5.2)

       You have deleted from the Gemfile:
       * postmark-rails
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby/Rails app

Auto packing the repository for optimum performance.
To [email protected]:sutra-staging.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:sutra-staging.git'
Everything up-to-date

My Gemfile.lock is in version control.

Upvotes: 1

Views: 375

Answers (2)

Tim Sullivan
Tim Sullivan

Reputation: 16898

What has happened is you have changed your Gemfile, but you have not locally updated your gems using Bundler. This means that your Gemfile file and your Gemfile.lock file are out of sync.

In order to fix this, run bundle install, commit your changes, and push again to Heroku. This will install the postmark-rails gem that you added, update the Gemfile.lock and get everything back in sync again.

What may have confused you is installing gems using gem install doesn't update the gems that Bundler is aware of. Bundler's job is to manage the gems for your project, so any time you add a new gem, make sure to run Bundler to update things.

Upvotes: 3

Shadwell
Shadwell

Reputation: 34784

You say your Gemfile.lock is in version control but your error messages are saying that the Gemfile.lock doesn't match your Gemfile.

You need to bundle install locally and commit your modified Gemfile.lock.

Upvotes: 5

Related Questions