4

I'm trying to upload a Rails 3.1 app (with CoffeeScript) to Heroku. Apparently, there are known issues with this (http://stackoverflow.com/questions/6075961/problem-deploying-rails-3-1-project-to-heroku-could-not-find-a-javascript-runtim), so I added this to my Gemfile:

group :production do
  gem 'therubyracer-heroku', '0.8.1.pre3'
end

Then, after a few more messing around, I found out I had to do the following:

group :production do
  gem 'therubyracer-heroku', '0.8.1.pre3'
  gem 'pg'
  # pg from http://stackoverflow.com/questions/6410623/heroku-error-when-launch-rails3-1-app-missing-postgres-gem
end

Now I hit this error: "You have modified your Gemfile in development but did not check the resulting snapshot (Gemfile.lock) into version control"

git push heroku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 402 bytes, done.
Total 3 (delta 2), 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
-----> 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
       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:
       * pg
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected, failed to install gems via Bundler

Well, there is no updated Gemfile.lock to commit... even after I run bundle update. What's going on? How the heck do I deploy to Heroku? I thought Ruby on Rails and Heroku were supposed to be easy to get started with!

Geoff
  • 9,470
  • 13
  • 52
  • 67

1 Answers1

2

Interesting timing because I recently was able to deploy a Rails 3.1 app to Heroku. First off, make sure that the Gemfile.lock is indeed checked into version control. Then, consider using this:

group :production do
  gem 'therubyracer', '~> 0.9.3.beta1'
end

This worked for me perfectly, and I too use the 'pg' gem. Now, I never got the error you did - but I do know that the 'therubyracer' gem I specified above takes care of a JS error on Heroku's (or maybe Sprockets'?) side.

Good Luck.

dmonopoly
  • 3,251
  • 5
  • 34
  • 49
  • I used your therubyracer and still get the same error: heroku rake db:migrate rake aborted! Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) – Geoff Jul 26 '11 at 17:45
  • Yeah, this error is apart from therubyracer gem. Are you only using PostgreSQL for production, or are you also using it for development or testing? Also, it may help if you post your complete Gemfile. – dmonopoly Jul 26 '11 at 17:53
  • 1
    Nvm, I figured it out... I had to include gem 'pg' in the :production group, and build without production locally. – Geoff Jul 27 '11 at 20:17