简体   繁体   English

为什么我的Rails应用程序无法部署(H10代码错误)并且Rails服务器无法启动?

[英]Why does my rails app not deploy (H10 code error) and rails server not start?

I am at the very start of a rails app with just a "hello world" page and the basic skeleton. 我只是用一个“ hello world”页面和基本框架的Rails应用程序的开始。 i am trying to deploy to heroku before i start working on it. 我开始尝试将其部署到heroku之前。 however, on both production and local server i can not get the app to start. 但是,在生产服务器和本地服务器上,我都无法启动该应用程序。 I did have it start once on local host 3000 but now i changed something and it doesn work. 我确实曾经在本地主机3000上启动过一次,但是现在我做了一些更改,但它不起作用。 the only things i changed were putting the sqlite gem into devlopment and pg gem into production since herku doesnt work with sqlite. 我唯一改变的就是将sqlite宝石投入开发,并将pg宝石投入生产,因为herku无法与sqlite配合使用。 please see following errors: 请查看以下错误:

when trying to start the local server: 尝试启动本地服务器时:

C:\Sites\nutri>rails s
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5-x86-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:91:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `each'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:86:in `block in require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `each'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/runtime.rb:75:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler.rb:107:in `require'
        from C:/Sites/nutri/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:88:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:88:in `block in server'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

when opening th eapp in production i get an H10 error, unfortunately herko suppor tpage doesnt go into any detail about how to fix this error and just states what the code means which i do not understand. 在生产环境中打开eapp时出现H10错误,不幸的是,herko支持页面并未详细介绍如何解决此错误,只是指出了代码含义,我不理解。

the heroku logs: heroku日志:

C:\Sites\nutri>heroku logs
This is the legacy Heroku CLI. Please install the new CLI from https://cli.heroku.com
2017-12-10T05:44:26.046591+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2017-12-10T05:44:26.046604+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
2017-12-10T05:44:26.046616+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:84:in `app'
2017-12-10T05:44:26.046628+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
2017-12-10T05:44:26.046639+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
2017-12-10T05:44:26.046649+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:104:in `start'
2017-12-10T05:44:26.046660+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:90:in `block in server'
2017-12-10T05:44:26.046670+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
2017-12-10T05:44:26.046680+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
2017-12-10T05:44:26.046690+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2017-12-10T05:44:26.046701+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
2017-12-10T05:44:26.046712+00:00 app[web.1]:    from bin/rails:4:in `require'
2017-12-10T05:44:26.046723+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2017-12-10T05:44:26.239147+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-10T05:44:32.729566+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-woodland-44138.herokuapp.com request_id=49085526-9dfc-4fe7-abba-b11be446f965 fwd="82.102.17.248" dyno= connect= service= status=503 bytes= protocol=https
2017-12-10T05:45:15.010455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-woodland-44138.herokuapp.com request_id=e090f107-9036-4e55-9d70-8f450c4aa7a2 fwd="82.102.17.248" dyno= connect= service= status=503 bytes= protocol=https
2017-12-10T06:09:54.415945+00:00 heroku[web.1]: State changed from crashed to starting
2017-12-10T06:09:56.992085+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 59932 -e production`
2017-12-10T06:10:00.485332+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-10T06:10:00.375617+00:00 app[web.1]: => Booting Puma
2017-12-10T06:10:00.375631+00:00 app[web.1]: => Rails 5.0.6 application starting in production on http://0.0.0.0:59932
2017-12-10T06:10:00.375632+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-12-10T06:10:00.375633+00:00 app[web.1]: Exiting
2017-12-10T06:10:00.375723+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/connection_specification.rb:176:in `rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
2017-12-10T06:10:00.375747+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/connection_specification.rb:173:in `spec'
2017-12-10T06:10:00.375748+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_handling.rb:53:in `establish_connection'
2017-12-10T06:10:00.375751+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
2017-12-10T06:10:00.375752+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
2017-12-10T06:10:00.375754+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
2017-12-10T06:10:00.375775+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
2017-12-10T06:10:00.375776+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
2017-12-10T06:10:00.375779+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
2017-12-10T06:10:00.469714+00:00 heroku[web.1]: Process exited with status 1
2017-12-10T06:10:00.375780+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:49:in `each'
2017-12-10T06:10:00.375782+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
2017-12-10T06:10:00.375783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/base.rb:324:in `<module:ActiveRecord>'
2017-12-10T06:10:00.375826+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.6/lib/active_record/base.rb:24:in `<top (required)>'
2017-12-10T06:10:00.375827+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
2017-12-10T06:10:00.375828+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
2017-12-10T06:10:00.375829+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
2017-12-10T06:10:00.375830+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
2017-12-10T06:10:00.375831+00:00 app[web.1]:    from /app/app/models/application_record.rb:1:in `<top (required)>'
2017-12-10T06:10:00.375832+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
2017-12-10T06:10:00.375832+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
2017-12-10T06:10:00.375833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
2017-12-10T06:10:00.375835+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
2017-12-10T06:10:00.375836+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:380:in `block in require_or_load'
2017-12-10T06:10:00.375837+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:37:in `block in load_interlock'
2017-12-10T06:10:00.375838+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2017-12-10T06:10:00.375839+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
2017-12-10T06:10:00.375840+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies/interlock.rb:11:in `loading'
2017-12-10T06:10:00.375842+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:37:in `load_interlock'
2017-12-10T06:10:00.375865+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:358:in `require_or_load'
2017-12-10T06:10:00.375866+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:336:in `depend_on'
2017-12-10T06:10:00.375868+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:252:in `require_dependency'
2017-12-10T06:10:00.375869+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2017-12-10T06:10:00.375871+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:475:in `each'
2017-12-10T06:10:00.375873+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:475:in `block in eager_load!'
2017-12-10T06:10:00.375891+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:473:in `each'
2017-12-10T06:10:00.375892+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:473:in `eager_load!'
2017-12-10T06:10:00.375893+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/engine.rb:354:in `eager_load!'
2017-12-10T06:10:00.375897+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
2017-12-10T06:10:00.375896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/application/finisher.rb:59:in `each'
2017-12-10T06:10:00.375901+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
2017-12-10T06:10:00.375899+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
2017-12-10T06:10:00.375920+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2017-12-10T06:10:00.375920+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2017-12-10T06:10:00.375919+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
2017-12-10T06:10:00.375922+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2017-12-10T06:10:00.375923+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2017-12-10T06:10:00.375925+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each'
2017-12-10T06:10:00.375943+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call'
2017-12-10T06:10:00.375944+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2017-12-10T06:10:00.375945+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2017-12-10T06:10:00.375947+00:00 app[web.1]:    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2017-12-10T06:10:00.375948+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
2017-12-10T06:10:00.375965+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
2017-12-10T06:10:00.375966+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2017-12-10T06:10:00.375968+00:00 app[web.1]:    from /app/config.ru:3:in `require_relative'
2017-12-10T06:10:00.375980+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2017-12-10T06:10:00.375982+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
2017-12-10T06:10:00.375983+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
2017-12-10T06:10:00.375990+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2017-12-10T06:10:00.375984+00:00 app[web.1]:    from /app/config.ru:in `new'
2017-12-10T06:10:00.375988+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
2017-12-10T06:10:00.375985+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2017-12-10T06:10:00.375987+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
2017-12-10T06:10:00.375985+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
2017-12-10T06:10:00.375992+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
2017-12-10T06:10:00.376005+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
2017-12-10T06:10:00.376005+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:84:in `app'
2017-12-10T06:10:00.376008+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:104:in `start'
2017-12-10T06:10:00.376010+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:90:in `block in server'
2017-12-10T06:10:00.376006+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
2017-12-10T06:10:00.376019+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
2017-12-10T06:10:00.376012+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
2017-12-10T06:10:00.376021+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2017-12-10T06:10:00.376027+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
2017-12-10T06:10:00.376048+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2017-12-10T06:10:00.376047+00:00 app[web.1]:    from bin/rails:4:in `require'
2017-12-10T06:27:43.466729+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-woodland-44138.herokuapp.com request_id=b7646d82-6d59-45b2-8040-e16cf89d513a fwd="82.102.17.248" dyno= connect= service= status=503 bytes= protocol=https

C:\Sites\nutri>

notice particularly the last line: 特别注意最后一行:

2017-12-10T06:27:43.466729+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=murmuring-woodland-44138.herokuapp.com request_id=b7646d82-6d59-45b2-8040-e16cf89d513a fwd="82.102.17.248" dyno= connect= service= status=503 bytes= protocol=https

I have searched and read many similar questions on here, but none seem to have an answer to my particular case. 我在这里搜索并阅读了许多类似的问题,但是似乎没有一个答案可以解决我的特殊情况。 any help much appreciated. 任何帮助,不胜感激。

EDIT: added gem file: 编辑:添加了gem文件:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.6'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3' #commented out see below
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'sqlite3' #, '1.3.5'#added here because didnt deploy to heroku, as advised on https://gist.github.com/JennDudley/2493288
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'

end

group :production do
  gem 'pg'
  #gem 'rails_12factor'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

EDIT 2, database.yml: 编辑2,database.yml:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: 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

EDIT 3: new config/datbase.yml file EDIT 4: new config/datbase.yml file (i accidentally added the wrong database yml file from another project, below is my database yml file) 编辑3:新的config / datbase.yml文件编辑4:新的config / datbase.yml文件(我不小心从另一个项目中添加了错误的数据库yml文件,以下是我的数据库yml文件)

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: postgresql #sqlite3
  pool: 5
  timeout: 5000

# development:
#   <<: *default
#   database: db/development.sqlite3
development:
  <<: *default
  database: nutri_development

# 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.postgresql #sqlite3

test:
  <<: *default
  database: nutri_test

# production:
#   <<: *default
#   database: db/production.postgresql #sqlite3
production:
  <<: *default
  database: nutri_production
  prepared_statements: false
  encoding: unicode

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
# default: &default
#   adapter: sqlite3
#   pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
#   timeout: 5000
# default: &default
#   adapter: postgresql
#   pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
#   timeout: 5000


# development:
#   <<: *default
#   database: db/development.sqlite3
# development:
#   <<: *default
# database: rails-tutorial_development #http://guides.rubyonrails.org/configuring.html#configuring-a-database

# 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
# test:
#   <<: *default
#   database: rails-tutorial_development

# production:
#   <<: *default
#   database: db/production.sqlite3

# production:
#   <<: *default
#   adapter: postgresql
#   prepared_statements: false
#   encoding: unicode
#   database: rails-tutorial_development

is this the correct configuration to use postgresql? 这是使用postgresql的正确配置吗?

See how in our default, you specify sqlite3 as the adapter? 请参阅默认情况下如何将sqlite3指定为适配器?

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

Then, in your production, you use the defaults plus specify the sqlite3 database. 然后,在生产环境中,使用默认值并指定sqlite3数据库。

production:
  <<: *default
  database: db/production.sqlite3

Instead, it should look something like: 相反,它应该类似于:

production:
  <<: *default
  adapter: postgresql
  encoding: unicode

Again, you really should set up postgresql on your development machine to avoid syntax differences between sqlite3 and postgresql. 同样,您确实应该在开发机器上设置postgresql,以避免sqlite3和postgresql之间的语法差异。

To provision a database, go onto the Resources tab of your application on Heroku. 要配置数据库,请在Heroku上转到应用程序的“资源”选项卡。 Under 'Add-ons', search for 'Postgres'. 在“附加组件”下,搜索“ Postgres”。 Heroku will walk you through from there. Heroku将引导您从那里通过。

Once you're set up, in your terminal you'll need to run: 设置完成后,您需要在终端中运行:

> heroku run rake db:migrate --app your_app_name

Or, if you'd rather load from your schema (which is the basically the result of all your migrations mashed into one file), you do something like: 或者,如果您希望从架构中加载(这基本上是将所有迁移混入一个文件中的结果),则可以执行以下操作:

> heroku run rake db:schema:load

REPLY 回复

Here's what my database.yml looks like for one of my apps (naturally, I've substituted 'app_name' in for my actual app name): 这是我的一个应用程序的database.yml样子(自然,我用'app_name'代替了我的实际应用程序名称):

default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see rails configuration guide
  # http://guides.rubyonrails.org/configuring.html#database-pooling
  pool: 5

...

production:
  <<: *default
  database: app_name_production
  username: app_name_admin
  password: <%= ENV['APP_NAME_DATABASE_PASSWORD'] %>

As you can see, I in fact have database: and username: in my production section. 如您所见,实际上我的生产部分中有database:username: username: may not be required, I'm not sure. username:可能不是必需的,我不确定。 According to SQLite on Heroku , you should include database: ... . 根据Heroku上的SQLite ,您应该包括database: ... But, as stated in the guide, it should be a custom name, not: 但是,如指南中所述,它应该是一个自定义名称,而不是:

database: db/production.sqlite3

The encoding and pool bits come from section 3.15.3 (Configuring a PostreSQL Database) of the Rails Guide on Configuring a Database . encodingpool位来自《 Rails指南》中有关配置数据库的第3.15.3节(配置PostreSQL数据库)。 You'll note that the Heroku guide does not specify encoding but the Rails guide does. 您会注意到,Heroku指南没有指定encoding但是Rails指南却指定了encoding I prioritize the Rails guide over the Heroku guide and so include it in all my database.yml files. 我将Rails指南优先于Heroku指南,因此将其包含在我的所有database.yml文件中。

You already include pool and timeout in our default , so you don't need to reconfigure those in production . 您已经在我们的default包含了pooltimeout ,因此您无需在production重新配置它们。

"Set up postgreSQL on your development machine" means installing a postgreSQL server on your local machine. “在开发计算机上设置postgreSQL”是指在本地计算机上安装postgreSQL服务器。 Simply including the pg gem does not install a server. 仅包含pg gem并不会安装服务器。 You will ONLY need to do this if you decide to use postgreSQL in development (instead of sqlite). 需要做到这一点,如果你决定在发展中使用PostgreSQL(而不是源码)。 This has nothing to do with deploying to Heroku. 这与部署到Heroku 无关

To learn more about installing postgresql on your machine, see the Local setup section of the Heroku Postgres guide. 要了解有关在计算机上安装postgresql的更多信息,请参见Heroku Postgres指南的Local setup部分。

You might also want to read the Dev/prod parity section of the Twelve-Factor App . 您可能还需要阅读“ 十二要素应用程序”的“ 开发/产品奇偶校验”部分。

If you decide to continue developing with sqlite and deploying with postgresql, then you can completely ignore my comment about setting up postgresql on your development machine. 如果您决定继续使用sqlite进行开发并使用postgresql进行部署,则可以完全忽略我有关在开发计算机上设置postgresql的评论。 However, as I said previously, sqlite and postgres have some subtle sytactic differences (the one I recall of the top of my head is how each of the databases implement LIKE functionality). 但是,正如我之前说过的,sqlite和postgres在语法上有一些细微的区别(我记得最主要的是每个数据库如何实现LIKE功能)。 What that means is that you could possibly have code that works flawlessly in development on sqlite but breaks in production on postgres. 这意味着您可能拥有在sqlite上的开发中可以完美运行但在postgres上的生产中断的代码。 If you run into that situation, you will have to track down where the syntax differences are causing errors and then remediate your syntax. 如果遇到这种情况,您将不得不找出语法差异导致错误的位置,然后对语法进行补救。 That is NO FUN. 那是没有乐趣的。

Your local server error is due to file 您的本地服务器错误是由于文件引起的

from C:/Sites/nutri/config/application.rb:7:in '<top (required)>'

error is 错误是

C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.5-x86-
mingw32/lib/sqlite3.rb:6:in 'require': cannot load such file -- 
sqlite3/sqlite3_native (LoadError)

check if file sqlite3/sqlite3_native exists. 检查文件sqlite3/sqlite3_native存在。

First try to deploy locally and think about Heroku. 首先尝试在本地部署并考虑一下Heroku。

Heroku server issue Heroku服务器问题

2017-12-10T06:10:00.375723+00:00 app[web.1]: 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-
5.0.6/lib/active_record/connection_adapters/
connection_specification.rb:176:in `rescue in spec': Specified 
'sqlite3' for database adapter, but the gem is not loaded. Add `gem 
'sqlite3'` to your Gemfile (and ensure its version is at the minimum 
required by ActiveRecord). (Gem::LoadError)

says Gem compatibility issue between rails (ActiveRecord) and sqlite3 . rails (ActiveRecord)和sqlite3之间的宝石兼容性问题。 Any reason you commented the version for sqlite3 ? 您有任何理由对sqlite3的版本发表评论吗? try uncommenting it 尝试取消注释

gem 'sqlite3', '1.3.5'

Only certain version of rails works with sqlite3 versions 只有某些版本的rails可以与sqlite3版本一起使用

Also, can pg gem have a version like below 另外, pg gem可以有如下版本吗

gem 'pg', '0.18.4'

Try all this, move your Gemfile.lock file 尝试所有这些,移动您的Gemfile.lock文件

mv Gemfile.lock Gemfile.lock_

install gems now 立即安装宝石

bundle install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Heroku Rails 3应用程序崩溃-错误H10(应用程序崩溃) - Heroku Rails 3 app crashing - Error H10 (App crashed) 铁路应用:heroku [路由器]:at =错误代码= H10 desc =“应用已崩溃” - RAILS APP : heroku[router]: at=error code=H10 desc=“App crashed” Heroku - 错误 H10(应用程序崩溃)Ruby on rails - Heroku - Error H10 (App crashed) Ruby on rails Heroku rails 应用程序在本地运行,但打开时给出应用程序错误代码 H10 - Heroku rails app runs locally but gives application error code H10 when opened Heroku Rails部署“ at =错误代码= H10 desc =”应用程序崩溃” - Heroku rails deployment “at=error code=H10 desc=”App crashed" Rails应用程序上的Heroku错误:错误代码= H10 desc =“应用程序崩溃”方法=获取路径=“ /favicon.ico”主机= - Heroku error on Rails app : error code=H10 desc=“App crashed” method=GET path=“/favicon.ico” host= rails heroku-错误代码H10 bash:bin / rails:没有这样的文件或目录 - rails heroku - error code H10 bash: bin/rails: No such file or directory Hartl的Ruby on Rails / Hello_App / Heroku错误H10 - Hartl's Ruby on Rails / Hello_App / Heroku Error H10 新的Rails Heroku应用程序引发ApplicationError(Heroku错误H10) - New Rails Heroku app throwing an ApplicationError (Heroku error H10) heroku[路由器]:at=错误代码=H10 desc=“应用程序崩溃” - heroku[router]: at=error code=H10 desc=“App crashed”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM