1

我正在尝试将我的Ruby on Railswebbapp 部署到 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

4

1 回答 1

0

我看到你有 3 个问题Gemfile

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

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

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

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

    这是不正确的,所以要修复它,从生产gem 'therubyracer', '0.12.1'组中删除,并gem "qrencoder","~> 1.4.1"从 -*production/staging_ 组中删除,然后从同一组中删除。然后 issue , next不是必需的,然后将生成的GemfileGemfile.lock添加到 git repo,然后提交,然后执行 git push。gem 'rails_12factor'ruby "2.3.0"bundle installbundle update

于 2016-04-26T12:51:40.070 回答