我正在尝试将我的Rails 4应用程序部署到Heroku,当我输入时:
git push heroku master
我收到以下错误:
-----> 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?
来自Rails Asset Pipeline on Heroku Cedar:
这意味着您的应用程序正在尝试作为rake资产的一部分连接到数据库:预编译。由于配置变量不存在于环境中,而这是Heroku用于配置数据库连接的机制,因此该命令失败。
页面建议我运行
env -i GEM_PATH=$GEM_PATH \
PATH=$PATH \
DATABASE_URL=postgres://user:pass@127.0.0.1/dbname \
/bin/sh -c 'bundle exec rake --trace assets:precompile'
当我这样做时,我收到以下错误:
耙子流产了! 找不到HOME环境 - 扩展~' /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
救援 /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
每个' /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
阻止运行' /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`'
产生此错误的原因是什么?我该如何解决?
答案 0 :(得分:0)
我不熟悉 user-env-compile ,但只是按照here所述设置了Devise键:
heroku config:set DEVISE_SECRET_KEY=whatever_the_key_is
确保您的初始值设定项使用如下所示的键:
config.secret_key = ENV['DEVISE_SECRET_KEY']
然后像这样禁用 user-env-compile :
heroku labs:disable user-env-compile -a myapp
然后尝试部署。