How do you fix this Heroku error with the pg gemfile and Rails 3.1?
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
Instal开发者_Python百科ling 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!
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.
精彩评论