Jack
Jack

Reputation: 5424

Precompilation failing heroku even when using user-env-compile

I'm trying to push up to Heroku, but I'm getting this error:

-----> 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?

I'm using Ruby 2.0 and Rails 4.0. I've seen posts that say I should enable user-env-compile so that my environment variables are used in Heroku slug compilation, so I did this:

heroku labs:enable user-env-compile --app <my app's name>

I've also disabled it and re-enabled it. But, I'm still getting the same error. What could be the problem? What am I doing wrong?

Upvotes: 1

Views: 405

Answers (1)

pdoherty926
pdoherty926

Reputation: 10349

It's less than ideal, but I was having a similar issue using Rails 4 on Heroku and resorted to pre-compiling locally using: RAILS_ENV=production bundle exec rake assets:precompile.

If you want to avoid having your compiled assets in master, you could create a deploy branch, pre-compile, commit, push to heroku and then destroy.

Upvotes: 1

Related Questions