[Heroku] Solution for rake assets:precompile Error in Rails 3.2 Apps
Here’s how to solve the rake assets:precompile error that occurs when doing git push of a Rails 3.2 app on Heroku.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
The solution is simply to add the following setting to application.rb:
config/application.rb
# For Heroku
config.assets.initialize_on_precompile = false
That’s all from solving the rake assets:precompile error on Heroku + Rails 3.2, from the Gemba.