Heroku崩溃

时间:2018-02-26 14:41:35

标签: ruby-on-rails heroku

我已经通过论坛,我无法弄清楚为什么我的heroku应用程序在启动时崩溃了。我点击"打开应用程序"它立即进入"应用程序错误,检查日志"屏幕。非常感谢任何帮助。

这是我的日志文件:

2018-02-26T09:24:49.347577+00:00 heroku[web.1]: Process exited with status 1
2018-02-26T09:24:49.234581+00:00 app[web.1]: /app/app/models/ability.rb:2:in `<class:Ability>': uninitialized constant Ability::CanCan (NameError)
2018-02-26T09:24:49.234642+00:00 app[web.1]:  from /app/app/models/ability.rb:1:in `<top (required)>'
2018-02-26T09:24:49.234663+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2018-02-26T09:24:49.234669+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
2018-02-26T09:24:49.234670+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
2018-02-26T09:24:49.234672+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2018-02-26T09:24:49.234678+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in `each'
2018-02-26T09:24:49.234679+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in `block in eager_load!'
2018-02-26T09:24:49.234681+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in `each'
2018-02-26T09:24:49.234682+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in `eager_load!'
2018-02-26T09:24:49.234683+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:354:in `eager_load!'
2018-02-26T09:24:49.234685+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in `each'
2018-02-26T09:24:49.234686+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
2018-02-26T09:24:49.234689+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in `run'
2018-02-26T09:24:49.234688+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in `instance_exec'
2018-02-26T09:24:49.234690+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:55:in `block in run_initializers'
2018-02-26T09:24:49.234692+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'
2018-02-26T09:24:49.234693+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'
2018-02-26T09:24:49.234695+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'
2018-02-26T09:24:49.234696+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'
2018-02-26T09:24:49.234702+00:00 app[web.1]:  from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each'
2018-02-26T09:24:49.234704+00:00 app[web.1]:  from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call'
2018-02-26T09:24:49.234705+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'
2018-02-26T09:24:49.234707+00:00 app[web.1]:  from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2018-02-26T09:24:49.234708+00:00 app[web.1]:  from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2018-02-26T09:24:49.234709+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:54:in `run_initializers'
2018-02-26T09:24:49.234729+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:352:in `initialize!'
2018-02-26T09:24:49.234731+00:00 app[web.1]:  from /app/config/environment.rb:5:in `<top (required)>'
2018-02-26T09:24:49.234737+00:00 app[web.1]:  from /app/config.ru:3:in `require_relative'
2018-02-26T09:24:49.234739+00:00 app[web.1]:  from /app/config.ru:3:in `block in <main>'
2018-02-26T09:24:49.234741+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'
2018-02-26T09:24:49.234742+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'
2018-02-26T09:24:49.234748+00:00 app[web.1]:  from /app/config.ru:in `new'
2018-02-26T09:24:49.234749+00:00 app[web.1]:  from /app/config.ru:in `<main>'
2018-02-26T09:24:49.234750+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'
2018-02-26T09:24:49.234755+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'
2018-02-26T09:24:49.234753+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'
2018-02-26T09:24:49.234752+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'
2018-02-26T09:24:49.234756+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'
2018-02-26T09:24:49.234758+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/server.rb:84:in `app'
2018-02-26T09:24:49.234759+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'
2018-02-26T09:24:49.234761+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'
2018-02-26T09:24:49.234762+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/server.rb:104:in `start'
2018-02-26T09:24:49.234764+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:90:in `block in server'
2018-02-26T09:24:49.234765+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:85:in `tap'
2018-02-26T09:24:49.234766+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:85:in `server'
2018-02-26T09:24:49.234768+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2018-02-26T09:24:49.234769+00:00 app[web.1]:  from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands.rb:18:in `<top (required)>'
2018-02-26T09:24:49.234771+00:00 app[web.1]:  from bin/rails:9:in `require'
2018-02-26T09:24:49.234772+00:00 app[web.1]:  from bin/rails:9:in `<main>'
2018-02-26T09:24:49.243493+00:00 app[web.1]: => Booting Puma
2018-02-26T09:24:49.243502+00:00 app[web.1]: => Rails 5.0.4 application starting in production on http://0.0.0.0:15755
2018-02-26T09:24:49.243504+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-26T09:24:49.243506+00:00 app[web.1]: Exiting
2018-02-26T09:24:49.411607+00:00 heroku[web.1]: State changed from starting to crashed
2018-02-26T14:17:21.837329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=code4discounts.herokuapp.com request_id=ee673e8b-04ee-4aae-ad93-131690bf6a71 fwd="73.15.233.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-26T14:17:23.636292+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=code4discounts.herokuapp.com request_id=54e1ec7d-ec3d-4a84-bf67-b3ff4361bf7f fwd="73.15.233.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-26T14:28:34.892704+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=code4discounts.herokuapp.com request_id=6a52d8cb-4373-4203-b1a5-79191ad97536 fwd="73.15.233.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-26T14:28:36.733388+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=code4discounts.herokuapp.com request_id=b8f831ee-88ca-4c65-8c1d-b9929caa72cf fwd="73.15.233.129" dyno= connect= service= status=503 bytes= protocol=https

1 个答案:

答案 0 :(得分:3)

远射,但这在早期发生在Heroku身上。

我猜测gem 'can_can'中缺少Gemfile

添加它,运行bundle install,然后确保将Gemfile.lock添加到git存储库,并提交对此文件的更改。

之前发生的事情是:我之前安装了一个gem(在不同的项目上),并且当运行一个新项目时 - 宝石可用。部署到Heroku后,它从Gemfile丢失,并且在那里不可用。

解决问题的一个好方法是always use bundle exec