我将我的Rails应用程序推送到Heroku并且它说“已成功安装”但是当我尝试打开它时说:
“应用程序错误 应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息。“
这是我的回购:https://github.com/cyqurayte/Rails1 我不明白日志中的错误(在日志的最底部),你能帮帮我吗?我尝试了两次,但返回相同。
2017-09-02T16:52:14.366977+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
2017-09-02T16:52:14.366997+00:00 app[web.1]: from bin/rails:9:in `require'
2017-09-02T16:52:14.366998+00:00 app[web.1]: from bin/rails:9:in `<main>'
2017-09-02T16:52:14.418105+00:00 app[web.1]: => Booting Puma
2017-09-02T16:52:14.418107+00:00 app[web.1]: => Rails 5.1.3 application starting in production on http://0.0.0.0:31449
2017-09-02T16:52:14.418108+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-09-02T16:52:14.418109+00:00 app[web.1]: Exiting
2017-09-02T16:52:14.568245+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-02T16:52:14.570537+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-02T16:52:17.689558+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 16636 -e production`
2017-09-02T16:52:21.271268+00:00 heroku[web.1]: Process exited with status 1
2017-09-02T16:52:21.159151+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
2017-09-02T16:52:21.159165+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec'
2017-09-02T16:52:21.159166+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection'
2017-09-02T16:52:21.159167+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/connection_handling.rb:58:in `establish_connection'
2017-09-02T16:52:21.159167+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>'
2017-09-02T16:52:21.159168+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/lazy_load_hooks.rb:45:in `instance_eval'
2017-09-02T16:52:21.159168+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/lazy_load_hooks.rb:45:in `execute_hook'
2017-09-02T16:52:21.159169+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
2017-09-02T16:52:21.159171+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
2017-09-02T16:52:21.159172+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
2017-09-02T16:52:21.159172+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/base.rb:326:in `<module:ActiveRecord>'
2017-09-02T16:52:21.159173+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.3/lib/active_record/base.rb:25:in `<top (required)>'
2017-09-02T16:52:21.159173+00:00 app[web.1]: from /app/app/models/application_record.rb:1:in `<top (required)>'
2017-09-02T16:52:21.159174+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
2017-09-02T16:52:21.159174+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
2017-09-02T16:52:21.159174+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
2017-09-02T16:52:21.159175+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
2017-09-02T16:52:21.159175+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:379:in `block in require_or_load'
2017-09-02T16:52:21.159176+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:36:in `block in load_interlock'
2017-09-02T16:52:21.159176+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2017-09-02T16:52:21.159176+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
2017-09-02T16:52:21.159177+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:11:in `loading'
2017-09-02T16:52:21.159178+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:36:in `load_interlock'
2017-09-02T16:52:21.159179+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:357:in `require_or_load'
2017-09-02T16:52:21.159196+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:335:in `depend_on'
2017-09-02T16:52:21.159197+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:251:in `require_dependency'
2017-09-02T16:52:21.159198+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2017-09-02T16:52:21.159213+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:475:in `each'
2017-09-02T16:52:21.159214+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:475:in `block in eager_load!'
2017-09-02T16:52:21.159215+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:473:in `each'
2017-09-02T16:52:21.159216+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:473:in `eager_load!'
2017-09-02T16:52:21.159227+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/engine.rb:354:in `eager_load!'
2017-09-02T16:52:21.159227+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/application/finisher.rb:67:in `each'
2017-09-02T16:52:21.159229+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `instance_exec'
2017-09-02T16:52:21.159229+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/application/finisher.rb:67:in `block in <module:Finisher>'
2017-09-02T16:52:21.159230+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `run'
2017-09-02T16:52:21.159231+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/initializable.rb:59:in `block in run_initializers'
2017-09-02T16:52:21.159232+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
2017-09-02T16:52:21.159234+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
2017-09-02T16:52:21.159235+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
2017-09-02T16:52:21.159247+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
2017-09-02T16:52:21.159247+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
2017-09-02T16:52:21.159248+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
2017-09-02T16:52:21.159248+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
2017-09-02T16:52:21.159250+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
2017-09-02T16:52:21.159250+00:00 app[web.1]: from /app/vendor/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
2017-09-02T16:52:21.159251+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/initializable.rb:58:in `run_initializers'
2017-09-02T16:52:21.159252+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/application.rb:353:in `initialize!'
2017-09-02T16:52:21.159255+00:00 app[web.1]: from config.ru:3:in `require_relative'
2017-09-02T16:52:21.159254+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2017-09-02T16:52:21.159256+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2017-09-02T16:52:21.159268+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
2017-09-02T16:52:21.159268+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
2017-09-02T16:52:21.159269+00:00 app[web.1]: from config.ru:in `new'
2017-09-02T16:52:21.159270+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
2017-09-02T16:52:21.159270+00:00 app[web.1]: from config.ru:in `<main>'
2017-09-02T16:52:21.159272+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
2017-09-02T16:52:21.159273+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
2017-09-02T16:52:21.159274+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2017-09-02T16:52:21.159275+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
2017-09-02T16:52:21.159288+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
2017-09-02T16:52:21.159276+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:24:in `app'
2017-09-02T16:52:21.159289+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:44:in `start'
2017-09-02T16:52:21.159288+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
2017-09-02T16:52:21.159290+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:131:in `block in perform'
2017-09-02T16:52:21.159290+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:126:in `tap'
2017-09-02T16:52:21.159292+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:126:in `perform'
2017-09-02T16:52:21.159294+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
2017-09-02T16:52:21.159293+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
2017-09-02T16:52:21.159295+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
2017-09-02T16:52:21.159298+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/command.rb:44:in `invoke'
2017-09-02T16:52:21.159296+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/command/base.rb:63:in `perform'
2017-09-02T16:52:21.159308+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
2017-09-02T16:52:21.159309+00:00 app[web.1]: from bin/rails:9:in `require'
2017-09-02T16:52:21.159309+00:00 app[web.1]: from bin/rails:9:in `<main>'
2017-09-02T16:52:21.189355+00:00 app[web.1]: => Booting Puma
2017-09-02T16:52:21.189358+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-09-02T16:52:21.189358+00:00 app[web.1]: => Rails 5.1.3 application starting in production on http://0.0.0.0:16636
2017-09-02T16:52:21.189359+00:00 app[web.1]: Exiting
2017-09-02T16:52:21.285641+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-02T16:52:43.214143+00:00 app[api]: Starting process with command `rails db:migrate` by user cherian.grundmann@gmail.com
2017-09-02T16:52:46.963608+00:00 heroku[run.8994]: Awaiting client
2017-09-02T16:52:47.023608+00:00 heroku[run.8994]: Starting process with command `rails db:migrate`
2017-09-02T16:52:47.075762+00:00 heroku[run.8994]: State changed from starting to up
2017-09-02T16:52:54.615275+00:00 heroku[run.8994]: Process exited with status 1
2017-09-02T16:52:54.628832+00:00 heroku[run.8994]: State changed from up to complete
2017-09-02T16:53:04.473474+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-depths-56542.herokuapp.com request_id=10fdf26d-2a66-4472-87e6-ece56707f399 fwd="95.91.246.64" dyno= connect= service= status=503 bytes= protocol=https
2017-09-02T16:53:04.837571+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-depths-56542.herokuapp.com request_id=13f1eb53-b357-4b0b-8a8b-05f20067caa2 fwd="95.91.246.64" dyno= connect= service= status=503 bytes= protocol=https
2017-09-02T16:56:34.250511+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-depths-56542.herokuapp.com request_id=8bb799bb-6c2b-4e0f-a470-e7967ff108ef fwd="95.91.246.64" dyno= connect= service= status=503 bytes= protocol=https
2017-09-02T16:56:34.727244+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-depths-56542.herokuapp.com request_id=77dad4f7-5a2f-4ee7-9177-3bf50127ffbb fwd="95.91.246.64" dyno= connect= service= status=503 bytes= protocol=https
答案 0 :(得分:1)
heroku中的日志并不总是提供足够的详细信息,您可能会丢失文件或者您已经考虑过的错误等等。当您在启动之前进行故障排除时,确保所有错误都得到了解决?尝试heroku run rails console
可能会让您更深入地了解您的问题。或者尝试heroku restart
并按照控制台错误进行操作。
答案 1 :(得分:0)
查看日志,您的应用程序似乎无法连接到您的数据库。这是因为它在错误中指出你缺少postgres gem,将gem 'pg'
添加到你的gem文件或确认你的database.yml设置正确。
答案 2 :(得分:0)
查看日志,您的应用程序似乎无法连接到您的数据库。这是由ActiveRecord抱怨
的事实所指出的答案 3 :(得分:0)
这是我的database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: pg
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
&#13;