【问题标题】:Heroku H10 error "App Crashed"Heroku H10 错误“应用程序崩溃”
【发布时间】:2016-08-20 06:01:18
【问题描述】:

我正在尝试将我的 Ruby on Rails webbapp 部署到 Heroku。在本地它工作得很好,但是当我尝试通过 Heroku 运行它时,它给了我一个 H10 错误 HTTP 状态 503。我猜这是因为bash: bundle: command not found。但是即使运行heroku run bundle exec rails server -p $PORT 也不起作用。

  2016-04-26T11:35:09.570021+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:35:09.570027+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:36:34.435961+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:36:34.435967+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:06.665673+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:37:06.665682+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:20.446113+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:37:20.446119+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:26.534228+00:00 heroku[web.1]: State changed from crashed to starting
    2016-04-26T11:37:32.239987+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 48566`
    2016-04-26T11:37:34.485283+00:00 app[web.1]: bash: bundle: command not found
    2016-04-26T11:37:35.145372+00:00 heroku[web.1]: Process exited with status 127
    2016-04-26T11:37:35.160181+00:00 heroku[web.1]: State changed from crashed to starting
    2016-04-26T11:37:35.157438+00:00 heroku[web.1]: State changed from starting to crashed
    2016-04-26T11:37:40.225006+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 57613`
    2016-04-26T11:37:41.536602+00:00 app[web.1]: bash: bundle: command not found
    2016-04-26T11:37:42.254167+00:00 heroku[web.1]: Process exited with status 127
    2016-04-26T11:37:42.273228+00:00 heroku[web.1]: State changed from starting to crashed
    2016-04-26T11:37:43.433890+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=4570bf17-d1d5-46f8-a2fa-9b3903e5f7b8 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:37:43.875014+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=justarandomname-sandbox.herokuapp.com request_id=bef38221-b815-42f0-bff9-a5af6ec9faef fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:37:43.928876+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=justarandomname-sandbox.herokuapp.com request_id=af6d1b23-6fca-4936-831a-8be720931110 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:18.973552+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=bdcbfa80-b930-458c-9838-22d143092149 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:30.012185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=7e6af745-e613-448c-be0e-be6c14c4499e fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:31.797207+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=11006d32-abf4-481e-896e-3da3a9778902 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:33.450964+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=731c163d-73dc-49d8-9334-96621b9afa99 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:35.451317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=1bf2c73c-cd8e-4b4a-a9c2-967934186c3f fwd="78.128.33.2" dyno= connect= service= status=503 bytes=

其他信息

过程文件:

web: bundle exec rails server -p $PORT
console: bundle exec rails console

Heroku 配置变量:

PATH        => bin:vendor/bundle/ruby/2.0.0/bin:qr/qrencode-3.2.0:bin:/.bin:/usr/local/bin:/usr/bin:/bin
GEM_PATH    => vendor/bundle/ruby/2.0.0
RACK_ENV    => production
RAILS_ENV   => production

Heroku 构建包:

https://github.com/incaztech/heroku-buildpack-qrencode.git

【问题讨论】:

  • 验证 Gemfile.lock 是否包含 bundler gem:cat Gemfile.lock|grep bundler
  • @МалъСкрылевъ 那个命令返回bundler (~> 1.0),所以它没有丢失?
  • 在 gemfile gem 'bundler', "~> 1.10.0" 中明确定义,还有 ruby​​ ruby 2.0.0
  • @МалъСкрылевъ 我添加了gem 'bundler', "~> 1.10.0"(也尝试使用gem 'bundler', "~> 1.0"),提交并推送,但仍然得到相同的错误pastebin.com/LSAb57Dc Gemfile 第 5 行和第 6 行供参考
  • 你明确声明了 ruby​​ 版本吗?

标签: ruby-on-rails heroku deployment gemfile gemfile.lock


【解决方案1】:

我在Gemfile看到你有3个问题:

  1. 您已在 assets 组中的 ruby 子句下定义了 gem 'therubyracer',然后您已将其重新声明为生产环境,并在没有子句的情况下暂存环境。那是不一致。

  2. 您已为生产和暂存环境重新定义 ruby 版本。这是错误的,因此 heroku 无法找到包含 bundle 可执行文件的捆绑 gem。

  3. 您的日志显示了一些记录:

    您的 Gemfile 不止一次列出了 gem rails_12factor (>= 0)。 您可能应该只保留其中一个。 虽然现在不是问题,但如果您以后只更改其中一个的版本,可能会导致错误。

    这是不正确的,所以要修复它,从 -*production/staging_ 组中删除 gem 'therubyracer', '0.12.1'gem "qrencoder","~> 1.4.1",从 production 组中删除 gem 'rails_12factor',然后从同一组。然后发出bundle install,不需要下一个bundle update,然后将生成的GemfileGemfile.lock添加到git repo,然后提交,然后执行git 推送。

【讨论】:

  • 您能否指定或发布我必须如何编辑它们以使其工作,我对 Ruby 不太熟悉:s
  • @Kupi 有没有也在本地重新打包然后更新Gemfile.lock
  • 我做了所有bundle installbundle update,提交,推送到heroku,仍然出现同样的错误
  • @Kupi 你能在提交后提供完整的日志 heroku 吗?
  • @Kupi 在bundle install 之后我没有看到git commit Gemfile.lock,在它之后不需要bundle update。我也更新了帖子
猜你喜欢
  • 2012-06-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多