【问题标题】:Application Error on heroku serverheroku 服务器上的应用程序错误
【发布时间】:2013-04-03 02:26:03
【问题描述】:

我尝试将我的第一个 Rails 项目推送到 heroku。但我得到“应用程序错误”: 应用程序发生错误,无法提供您的页面。请稍后重试。 如果您是应用程序所有者,请查看您的日志以了解详细信息。

我不明白错误是什么。我的日志:

C:\Sites\calend>heroku logs
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from script/rails:6:in `<main>'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from script/rails:6:in `require'

←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/config/environment.rb:
5:in `<top (required)>'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in
require'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initialize
rs'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
←[36m2013-04-02T16:43:48+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
←[36m2013-04-02T16:43:50+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-04-02T16:43:50+00:00 heroku[web.1]:←[0m State changed from starting to
 crashed
←[36m2013-04-02T16:54:08+00:00 heroku[web.1]:←[0m State changed from crashed to
starting
←[36m2013-04-02T16:54:10+00:00 heroku[web.1]:←[0m Starting process with command
`bundle exec rails server -p 53576`
←[36m2013-04-02T16:54:13+00:00 app[web.1]:←[0m DEPRECATION WARNING: You have Rai
ls 2.3-style plugins in vendor/plugins! Support for these plugins will be remove
d in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in t
o your app as lib/myplugin/* and config/initializers/myplugin.rb. See the releas
e notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-r
c2-has-been-released. (called from <top (required)> at /app/config/environment.r
b:5)
←[36m2013-04-02T16:54:13+00:00 app[web.1]:←[0m DEPRECATION WARNING: You have Rai
ls 2.3-style plugins in vendor/plugins! Support for these plugins will be remove
d in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in t
o your app as lib/myplugin/* and config/initializers/myplugin.rb. See the releas
e notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-r
c2-has-been-released. (called from <top (required)> at /app/config/environment.r
b:5)
←[36m2013-04-02T16:54:13+00:00 app[web.1]:←[0m DEPRECATION WARNING: You have Rai
ls 2.3-style plugins in vendor/plugins! Support for these plugins will be remove
d in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in t
o your app as lib/myplugin/* and config/initializers/myplugin.rb. See the releas
e notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-r
c2-has-been-released. (called from <top (required)> at /app/config/environment.r
b:5)
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m => Rails 3.2.1 application starti
ng in production on http://0.0.0.0:53576
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m => Booting WEBrick
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m => Ctrl-C to shutdown server
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_depe
ndency'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connec
tion_specification.rb:25:in `spec'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m Exiting
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/1.9.1/gem
s/bundler-1.3.2/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem
': Please install the postgresql adapter: `gem install activerecord-postgresql-a
dapter` (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m => Call with -d to detach
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connec
tion_specification.rb:127:in `establish_connection'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in `instanc
e_eval'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connec
tion_specification.rb:48:in `resolve_hash_connection'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.
1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connect
ion_specification.rb:39:in `resolve_string_connection'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in `execute
_hook'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in
require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/railtie.rb:76:in `block (2 levels)
in <class:Railtie>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_depe
ndency'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/devise-2.2.3/lib/devise/orm/active_record.rb:3:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in
require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adap
ter.rb:6:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/devise-2.2.3/lib/devise.rb:258:in `setup'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config/initializers/de
vise.rb:3:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config/initializers/de
vise.rb:16:in `block in <top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:42:in `run_loa
d_hooks'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:42:in `each'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.1/lib/active_record/base.rb:716:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:43:in `block i
n run_load_hooks'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in <class:En
gine>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `block in
load'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_depe
ndency'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initialize
rs'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config/environment.rb:
5:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in
require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config.ru:3:in `block
in <main>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_depe
ndency'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands/server.rb:46:in `app'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config.ru:in `<main>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/config.ru:in `new'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from script/rails:6:in `<main>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands/server.rb:70:in `start'
←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from script/rails:6:in `require'

←[36m2013-04-02T16:54:15+00:00 app[web.1]:←[0m  from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.1/lib/rails/commands.rb:55:in `block in <top (required)>'
←[36m2013-04-02T16:54:16+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-04-02T16:54:16+00:00 heroku[web.1]:←[0m State changed from starting to
 crashed
←[33m2013-04-02T16:58:52+00:00 heroku[api]:←[0m Starting process with command `b
undle exec rake -T` by aigool@mail.ru
←[32m2013-04-02T16:58:54+00:00 heroku[run.1117]:←[0m Awaiting client
←[32m2013-04-02T16:58:54+00:00 heroku[run.1117]:←[0m Starting process with comma
nd `bundle exec rake -T`
←[32m2013-04-02T16:58:56+00:00 heroku[run.1117]:←[0m State changed from starting
 to up
←[32m2013-04-02T16:59:00+00:00 heroku[run.1117]:←[0m Process exited with status
0
←[32m2013-04-02T16:59:00+00:00 heroku[run.1117]:←[0m State changed from up to co
mplete

【问题讨论】:

  • 可能还有其他问题正在发生...但这可能是您的问题之一:Please install the postgresql adapter: gem install activerecord-postgresql-a dapter (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
  • 但我的项目中没有使用 Postgre。我使用 MySQL。
  • 您使用远程 MySQL 数据库吗?也许这可以帮助:stackoverflow.com/questions/5397028/…
  • 你能从 Gemfile 发布你的制作组吗?
  • 我的 Gemfile: source 'rubygems.org' gem 'rails', '3.2.1' gem 'mysql2' group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' gem 'devise' gem 'calendar_date_select' gem 'watu_table_builder', :require => " table_builder" gem 'ice_cube' gem 'activerecord-postgresql-adapter'

标签: ruby-on-rails heroku


【解决方案1】:

您在错误消息中看到它:

Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` 
(pg is not part of the bundle. Add it to Gemfile.)

【讨论】:

  • 请发布您的 database.yml
  • 非常感谢,我将 database.yml 'mysql2' 更改为 'postgresql' 并添加到 gemfile "gem 'activerecord-postgresql-adapter'"。现在它可以工作了。所以我不能在heroku使用mysql数据库?
【解决方案2】:

最好有下面这样的组。

示例 Gemfile:

开发组:sqlite3,因为与 postgresql 相比,它不需要任何数据库设置过程

group :development do
  gem 'sqlite3'
end

生产组

group :production do
  gem 'pg'
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-04
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-10
    • 1970-01-01
    相关资源
    最近更新 更多