heroku拒绝了git push并发出警告“DEPRECATION WARNING:你在供应商/插件中有Rails 2.3风格的插件”和

时间:2020-12-20 20:38:40

Heroku is rejecting the push with the following message:

Heroku拒绝推送以下消息:

-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Running: rake assets:precompile
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out
and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on
this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_c758e521-24e9-4477-b6d7-73
cc961fb8d2/Rakefile:7)
       DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out
and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on
this:  (called from <top (required)> at /tmp/build_c758e521-24e9-4477-b6d7-73
cc961fb8d2/Rakefile:7)
       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_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:1222:in `initialize'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:1222:in `new'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:1222:in `connect'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:324:in `initialize'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:28:in `new'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgre
sql_adapter.rb:28:in `postgresql_connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:315:in `new_connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:325:in `checkout_new_connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:247:in `block (2 levels) in checkout'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:242:in `loop'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:242:in `block in checkout'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:239:in `checkout'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:102:in `block in connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:101:in `connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_pool.rb:410:in `retrieve_connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_specification.rb:171:in `retrieve_connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstrac
t/connection_specification.rb:145:in `connection'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:310:in `cle
ar_cache!'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/railtie.rb:103:in `block (2
 levels) in <class:Railtie>'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:418:in `_run
__1575907776091260551__prepare__1163126976531258673__callbacks'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__ru
n_callback'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run
_prepare_callbacks'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_c
allbacks'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:74:i
n `prepare!'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:48:i
n `prepare!'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application/finisher.rb:47:in `block in
 <module:Finisher>'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `run'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:55:in `block in run_in
itializers'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `each'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `run_initializer
s'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:136:in `initialize!'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:in `method_m
issing'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/config/environment.rb:5:in `<top (required)>'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `r
equire'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `b
lock in require'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `l
oad_dependency'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `r
equire'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:103:in `require_environm
ent!'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/application.rb:305:in `block (2 levels)
 in initialize_tasks'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:93:in `block (2 level
s) in <top (required)>'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:60:in `block (3 level
s) in <top (required)>'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:23:in `invoke_or_rebo
ot_rake_task'
       /tmp/build_c758e521-24e9-4477-b6d7-73cc961fb8d2/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/sprockets/assets.rake:29:in `block (2 level
s) in <top (required)>'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

I've tried other's solutions in * without any success:

我在*中尝试过其他解决方案但没有成功:

  1. include gem rails_12factor

    包括gem rails_12factor

  2. add the line " config.assets.initialize_on_precompile = false" in the application.rb

    在application.rb中添加“config.assets.initialize_on_precompile = false”行

  3. putting Sql3lite gem in the development/test group

    将Sql3lite gem放在开发/测试组中

and I've also tried some of my own including:

而且我也尝试了一些自己的,包括:

  1. create a new stack cedar application

    创建一个新的堆栈雪松应用程序

  2. add a new SSH key

    添加新的SSH密钥

  3. installed Heroku toolbelt.

    安装了Heroku工具带。

  4. commenting out PG gem in production

    在生产中评论PG宝石

  5. remove Gemfile.lock

    删除Gemfile.lock

My code is at https://github.com/charleshsu168/sample_app1 I am folloing Michael Hartl tutorial.

我的代码在https://github.com/charleshsu168/sample_app1我正在接受Michael Hartl教程。

2 个解决方案

#1


0  

The DEPRECATION WARNING: 's are unrelated to your issue, I get them on my live servers.

DEPRECATION WARNING:与你的问题无关,我把它们放在我的实时服务器上。

It looks like Rails thinks that your DB server is available locally hence it is trying to connect to 127.0.0.1 which is localhost.

看起来Rails认为您的数据库服务器在本地可用,因此它尝试连接到127.0.0.1,这是localhost。

Based on the logs, looks like a DB configuration issue. Do you have postgres configured correctly. https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby.

基于日志,看起来像数据库配置问题。你有正确配置的postgres吗? https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby。

postgresql_adapter.rb:28:in `postgresql_connection'

postgresql_adapter.rb:28:在`postgresql_connection'中

#2


0  

I've got it to work somehow by trial and error. One of the thing I did is I deleted the old Heroku remote URL that doesn't exist anymore in .git/config, replace it with the new Heroku app name I've created, and then re-run: Heroku push master Now it works!

我通过反复试验以某种方式工作。我做的一件事就是删除了.git / config中不再存在的旧Heroku远程URL,将其替换为我创建的新Heroku应用程序名称,然后重新运行:Heroku push master现在它作品!

#1


0  

The DEPRECATION WARNING: 's are unrelated to your issue, I get them on my live servers.

DEPRECATION WARNING:与你的问题无关,我把它们放在我的实时服务器上。

It looks like Rails thinks that your DB server is available locally hence it is trying to connect to 127.0.0.1 which is localhost.

看起来Rails认为您的数据库服务器在本地可用,因此它尝试连接到127.0.0.1,这是localhost。

Based on the logs, looks like a DB configuration issue. Do you have postgres configured correctly. https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby.

基于日志,看起来像数据库配置问题。你有正确配置的postgres吗? https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby。

postgresql_adapter.rb:28:in `postgresql_connection'

postgresql_adapter.rb:28:在`postgresql_connection'中

#2


0  

I've got it to work somehow by trial and error. One of the thing I did is I deleted the old Heroku remote URL that doesn't exist anymore in .git/config, replace it with the new Heroku app name I've created, and then re-run: Heroku push master Now it works!

我通过反复试验以某种方式工作。我做的一件事就是删除了.git / config中不再存在的旧Heroku远程URL,将其替换为我创建的新Heroku应用程序名称,然后重新运行:Heroku push master现在它作品!