我正在尝试将我的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=
Procfile:
web: bundle exec rails server -p $PORT
console: bundle exec rails console
Heroku配置vars:
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 buildpacks:
答案 0 :(得分:0)
我在Gemfile
看到你有3个问题:
您已在gem 'therubyracer'
组中的ruby
子句下定义了assets
,然后您将其重新红外用于生产,并且没有子句的登台环境。这是不一致的。
您已为生产和登台环境重新定义ruby
版本。这是错误的,因此heroku无法找到包含bundle
可执行文件的捆绑宝石。
您的日志会显示一些记录:
您的Gemfile多次列出gem rails_12factor(> = 0)。 你应该只保留其中一个。 虽然现在不是问题,但如果稍后更改其中一个版本,可能会导致错误。
这是不正确的,所以要解决此问题,请从 - * production / staging_ group删除gem 'therubyracer', '0.12.1'
和gem "qrencoder","~> 1.4.1"
,从 production 组删除gem 'rails_12factor'
,然后从同一组中删除ruby "2.3.0"
。然后发出bundle install
,不需要下一个bundle update
,然后将结果 Gemfile 和 Gemfile.lock 添加到git repo,然后提交,就在那之后做git push。