I am attempting to deploy my Rails 4 app to Heroku, and when I enter:
git push heroku master
I get the following 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?
From the Rails Asset Pipeline on Heroku Cedar:
This means that your app is attempting to connect to the database as part of rake assets:precompile. Because the config vars are not present in the environment and this is the mechanism the Heroku uses to configure your database connection, the command is failing.
The page suggests that I run
env -i GEM_PATH=$GEM_PATH \
PATH=$PATH \
DATABASE_URL=postgres://user:[email protected]/dbname \
/bin/sh -c 'bundle exec rake --trace assets:precompile'
When I do, I get the following error:
rake aborted! couldn't find HOME environment -- expanding
~' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile/generator.rb:20:in
expand_path' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile/generator.rb:20:in<class:Generator>' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile/generator.rb:9:in
' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile/generator.rb:2:in<module:Guard>' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile/generator.rb:1:in
' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile.rb:2:inrequire' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/guardfile.rb:2:in
' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/dsl.rb:1:inrequire' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard/dsl.rb:1:in
' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard.rb:6:inrequire' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-2.2.4/lib/guard.rb:6:in
' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-rspec-4.2.0/lib/guard/rspec.rb:1:inrequire' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/guard-rspec-4.2.0/lib/guard/rspec.rb:1:in
' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:inrequire' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in
rescue in block in require' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:66:inblock in require' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
each' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:inrequire' /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in
require' /Users/dmanaster1/flatiron_school/SourceQ-An/config/application.rb:5:in<top (required)>' /Users/dmanaster1/flatiron_school/SourceQ-An/Rakefile:5:in
require' /Users/dmanaster1/flatiron_school/SourceQ-An/Rakefile:5:in<top (required)>' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in
load' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:inload_rakefile' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:637:in
raw_load_rakefile' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:94:inblock in load_rakefile' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in
standard_exception_handling' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:93:inload_rakefile' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:77:in
block in run' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:instandard_exception_handling' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in
run' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in<top (required)>' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/bin/rake:23:in
load' /Users/dmanaster1/flatiron_school/SourceQ-An/vendor/cache/ruby/2.0.0/bin/rake:23:in `'
What is generating this error? How can I fix it?