2

I've been trying to trouble shoot this error now for a couple hours without making any progress. I've tried running bundle install in different environments with no luck. I'm not sure what is happening and I feel as if the error is no longer providing relevant feedback. However, I am using Ruby 1.9.3 and when I push it states that Heroku is using ruby 2.0.0. Could this have something to do with it?

Castillos-MacBook-Pro:reservester-nysum13 castillo$ git push heroku master
Identity added: /Users/castillo/.ssh/id_rsa (/Users/castillo/.ssh/id_rsa)
Counting objects: 66, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (66/66), 26.25 KiB, done.
Total 66 (delta 4), reused 38 (delta 1)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       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:
       * debugger
       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:
       * debugger
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:guarded-sierra-5306.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:guarded-sierra-5306.git'

gem 'debugger' originally was placed outside of the environment group. I moved it to the development group and reran bundle.

Here is my Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'
gem 'carrierwave'
gem 'rmagick'
gem "fog", "~> 1.3.1"
gem "devise"
gem "figaro"
gem "galetahub-simple_captcha", :require => "simple_captcha"

group :development do
    gem 'annotate'
    gem 'sqlite3'
    gem 'rspec-rails', '~> 2.0'
    gem 'debugger'
end

group :production do
    gem 'pg'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
Smooth
  • 956
  • 1
  • 15
  • 37
  • Did you do what the error message says? – sevenseacat Jun 26 '13 at 12:14
  • Yes, I did. Tried running bundle install in many different variations to make sure. The gems appear to be installed in the proper environments. – Smooth Jun 26 '13 at 12:15
  • And did you commit the resulting Gemfile.lock to your version control? – sevenseacat Jun 26 '13 at 12:15
  • Yes, I committed as well. – Smooth Jun 26 '13 at 12:20
  • I tried everything that was recommended here: http://stackoverflow.com/questions/11513623/bundler-you-are-trying-to-install-in-deployment-mode-after-changing-your-gemfil – Smooth Jun 26 '13 at 12:22
  • To double check: bundle install --without development test returned nothing to commit (working directory clean) after running git status. I then bundled for dev and test and environments and was told that there is nothing to commit. – Smooth Jun 26 '13 at 12:24
  • Add this line to your `Gemfile` to make sure the Ruby version is similar in your dev and Heroku environments: `ruby "1.9.3"` – Chris Peters Jun 26 '13 at 13:41
  • Tried that and it's still producing the same error. – Smooth Jun 26 '13 at 16:02

4 Answers4

6

I got similar error. I tried delete Gemfile.lock file manually, rebundle, push it to git and still no luck. But finally I make it work by change my rvm version to ruby 2.0.0, precomplie the asset with this command

RAILS_ENV=production bundle exec rake assets:precompile

and delete the Gemfile.lock, rebundle, and push it to github. Last part when you push in to heroku use your branch instead your master, this happen because you not deploying the master branch to heroku master branch with this command:

git push heroku your-branch:master

mcbuddy
  • 199
  • 1
  • 9
  • 1
    Somehow i missed the branch and was trying to do so many other stupid things. Finally go it working using the appropriate branch while pushing to heroku. Thanks – Magesh Jul 27 '13 at 19:17
  • Worked for me only deleting `Gemfile.lock` and deploy with `heroku build:create` (https://github.com/heroku/heroku-builds). – leompeters Aug 14 '20 at 20:26
3

I had a similar situation. Heroku does not support every ruby version. You may be using an unsupported version.

  1. Check for Heroku Ruby supported versions
  2. Change your local ruby version. For example, if you are using rbenv rbenv local 2.1.6
  3. bundle install
  4. Push the changes to herokugit push heroku master
Logan Rice
  • 81
  • 4
0

You can't expect Heroku to know what version of Ruby you're running locally :-) If you want Heroku to use a particular version, tell it. Add ruby '1.9.3' to your Gemfile for example.

It also looks like you didn't rerun bundle install after putting the gem in development group? Try that.

Then add all the changes to git, commit, and push.

Jon Mountjoy
  • 4,498
  • 22
  • 24
  • I tried that and for some reason Heroku still thinks I want to use Ruby 2.0. I upgraded my bundler to version 1.2.0, tried again, and still no luck. – Smooth Jun 27 '13 at 14:25
  • I also tried putting ruby '1.9.3' in the production group inside my gemfile. – Smooth Jun 27 '13 at 17:32
-2

This problem is bacause you commit bad (old) Gemfile.lock to heroku server. You need to update Gemfile.lock on heroku after adding/removing gems.

Do following steps:

  1. save HEROKU_APP_NAME of existing heroku app ( HEROKU_APP_NAME.herokuapp.com )
  2. remove heroku application from https://dashboard.heroku.com/apps and create new one
  3. rename new heroku app to old HEROKU_APP_NAME
  4. remove Gemfile.lock from your git repo
  5. remove Gemfile.lock form your local project and form .gitignore (if it exist there)
  6. run bundle install
  7. commit changes to git repo ( new created Gemfile.lock )
  8. run git push heroku master
bmalets
  • 3,207
  • 7
  • 35
  • 64