推送到Heroku时,将rake gem更新为10.0.3输出错误?

时间:2013-01-09 03:21:17

标签: ruby-on-rails postgresql heroku rake rack

在我的Rails应用程序中,我刚刚从0.9.2.2更新了rake gem。到10.0.3,机架从1.4.1到1.4.3。

在更新宝石之前,当我向Heroku做git push时,我的输出就像这样:

-----> Writing config/database.yml to read from DATABASE_URL
-----> 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

(不关心资产预编译失败;我知道为什么会发生这种情况)

但是现在更新宝石后,当我推送到Heroku时,我得到了这个错误:

-----> Writing config/database.yml to read from DATABASE_URL
-----> 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?
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `initialize'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `new'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `connect'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:308:in `clear_cache!'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:418:in `_run__769451004690509272__prepare__527462282276125186__callbacks'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
       /tmp/build_15ju6av9wl7bb/config/environment.rb:5:in `<top (required)>'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:292:in `block (2 levels) in initialize_tasks'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
       /tmp/build_15ju6av9wl7bb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
       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

这里发生了什么?这是我需要解决的问题吗?该应用似乎仍然运行良好,但我想知道至少导致错误的原因。在版本10.0.3或其他东西中,rake是否更加冗长?

1 个答案:

答案 0 :(得分:1)

看起来新版本的rake只是更加冗长。如果您不需要访问数据库来编译资产(通常不会),您可以添加

config.assets.initialize_on_precompile = false

config/application.rb

有关详细信息,请参阅https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar