预编译资产失败

我正在推动一个我几个月没有更新的应用程序,我遇到了这个问题。 我只在代码中更改了一些变量。 不知道为什么突然这样对我。

! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app To git@heroku.com:myapp.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@heroku.com:myapp.git' 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? /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `new' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `connect' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:308:in `clear_cache!' /tmp/build_8c6e6263-c5c9-44ac-88ad-7eadb7c4c0e6/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/railtie.rb:104:in `block (2 levels) in ' 

可以在heroku支持页面上找到资产重新编译问题的最常见原因。

根据错误消息中提到的Postgres,我会尝试将config / application.rb中的以下行更改为false,如下所示: config.assets.initialize_on_precompile = false

您应该通过确保config / application.rb中包含以下行来阻止初始化应用程序并连接到数据库:

 config.assets.initialize_on_precompile = false