【问题标题】:heroku[router]: at=error code=H10 desc="App crashed"heroku[路由器]: at=error code=H10 desc="App 崩溃"
【发布时间】:2014-07-23 07:57:49
【问题描述】:

我已将我的应用程序部署到 heroku。我可以成功推送它。但是当运行 heroku open 时,它会显示错误:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.

如果您是应用程序所有者,请查看您的日志以了解详细信息。

然后我使用命令 heroku 记录它显示错误,如下所示:

...
2014-07-27T01:18:25.726069+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=********.herokuapp.com request_id=1ded5a34-7d01-440b-9fb4-0041fdc64715 fwd="110.74.222.57" dyno= connect= service= status=503 bytes=

请帮帮我!

【问题讨论】:

  • 它立即之前说了什么?
  • 您是否将页面设置为root。我认为它正在寻找显示为“www.yoursitename.com\”的路线,但如果没有页面是根页面,它就不会在那里。
  • 在 router.rb 中是的,我将 root :to =>'homes#index' 设置为默认加载页面
  • 能否发布您的 config/routes.rb 以及更多(或全部)错误日志?

标签: ruby-on-rails heroku


【解决方案1】:

这可能有几个原因,

试试

heroku run console 

它应该向您显示确切的错误。 就我而言,配置文件夹中的 application.rb 文件有问题。

你在你的应用中做了什么特别的事情吗?你删除了 ActiveRecord 吗?你在使用一些特定的宝石吗?

【讨论】:

    【解决方案2】:

    在我的情况下的解决方案,在 gemfile 中添加 pg gem 的最后一个版本,就像这样:

    gem 'pg', '~> 0.18.4'
    

    我希望你工作

    【讨论】:

      【解决方案3】:

      我对 Rails 的了解还不够,不知道这是否有帮助,但我正在阅读 Ruby on Rails 教程(第 6 版)并遇到此错误。查看日志文件显示 User.rb 类中存在错误,并指出教程建议添加用于内容验证的两行存在问题。我注释掉了这两行并重新部署到 Heroku,它运行良好。我取消了这两行的注释并再次部署,并且出现了错误。这是该类的列表。

      class User < ApplicationRecord
          has_many :microposts
            #validates FILL_IN, presence: true # replace FILL_IN with the rightcode.
            #validates FILL_IN, presence: true # replace FILL_IN with the rightcode.     
      end
      

      【讨论】:

        猜你喜欢
        • 2019-07-02
        • 1970-01-01
        • 1970-01-01
        • 2016-07-21
        • 2020-12-13
        • 1970-01-01
        • 1970-01-01
        • 2015-03-01
        • 2013-03-30
        相关资源
        最近更新 更多