将rails 4 app部署到Heroku时出错

时间:2022-06-11 00:13:19

I'm relatively new to using rails and I'm having a problem with deploying my app to Heroku. I've been developing on cloud 9 and when I push to Heroku the deploy seems to go fine but when I visit the page I get an error message.

我对使用rails比较陌生,而且我将我的应用程序部署到Heroku时遇到了问题。我一直在使用cloud 9进行开发,当我推送到Heroku时,部署似乎很顺利但是当我访问该页面时,我收到一条错误消息。

The heroku Logs show:

heroku日志显示:

> 2015-08-01T00:40:57.837873+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T00:40:58.556903+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T00:40:58.536297+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T06:17:19.117796+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T06:17:23.307569+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 52477 -e production`
2015-08-01T06:17:24.882803+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T06:17:25.734232+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T06:17:25.747443+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T11:53:45.697762+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T11:53:50.557525+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 10565 -e production`
2015-08-01T11:53:51.908604+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T11:53:52.785739+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T11:53:52.800814+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T14:41:40.344671+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-01T14:41:40.344696+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-01T14:41:40.288575+00:00 heroku[api]: Deploy 0b99a6d by siansapp@gmail.com
2015-08-01T14:41:40.288575+00:00 heroku[api]: Release v15 created by siansapp@gmail.com
2015-08-01T14:41:40.679507+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T14:41:45.306418+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 8728 -e production`
2015-08-01T14:41:47.429945+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T14:41:48.366370+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T14:41:48.378255+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T14:41:48.378255+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T14:41:57.271432+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 13560 -e production`
2015-08-01T14:41:59.763596+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T14:42:00.751968+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T14:42:00.692217+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T15:26:56.794786+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T15:27:01.996396+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 24984 -e production`
2015-08-01T15:27:04.117927+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T15:27:05.076538+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T15:27:05.065908+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T16:18:08.915947+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T16:18:13.350621+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40930 -e production`
2015-08-01T16:18:15.489473+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T16:18:16.308171+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T16:18:16.330662+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T18:03:47.083386+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T18:03:51.426448+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 12413 -e production`
2015-08-01T18:03:53.202502+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T18:03:54.025103+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T18:03:54.049376+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T20:31:29.290114+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=jump-start-app.herokuapp.com request_id=b94c555a-8552-49ef-98d4-e992c4b7f37a fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:31:31.068880+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=jump-start-app.herokuapp.com request_id=17e02081-6b91-4125-810a-75fd7553717b fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:31:31.559148+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jump-start-app.herokuapp.com request_id=9f1735da-4e59-48cd-bc7a-6c2972fdc74a fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:38:59.452899+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=jump-start-app.herokuapp.com request_id=56246be2-0ed6-4341-9bdb-c09503ef574e fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:38:59.922565+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jump-start-app.herokuapp.com request_id=0da233c6-1dd4-4cab-ae1a-bd660e5a3b4c fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:40:43.146796+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=jump-start-app.herokuapp.com request_id=89eb8e2b-0065-4d5f-bedf-619cfe1a7448 fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T20:40:43.592172+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jump-start-app.herokuapp.com request_id=13b4580c-7d73-4557-ab70-bee7c9694c67 fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T21:10:41.735259+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:10:46.688534+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 38883 -e production`
2015-08-01T21:10:48.844712+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T21:10:49.790883+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:10:49.771420+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:14:33.052844+00:00 heroku[api]: Starting process with command `bash` by siansapp@gmail.com
2015-08-01T21:14:41.082824+00:00 heroku[run.5556]: Starting process with command `bash`
2015-08-01T21:14:41.028523+00:00 heroku[run.5556]: Awaiting client
2015-08-01T21:14:41.485121+00:00 heroku[run.5556]: State changed from starting to up
2015-08-01T21:14:43.502980+00:00 heroku[run.5556]: Process exited with status 127
2015-08-01T21:14:43.511383+00:00 heroku[run.5556]: State changed from up to complete
2015-08-01T21:45:49.793767+00:00 heroku[api]: Deploy fbedf97 by siansapp@gmail.com
2015-08-01T21:45:49.793767+00:00 heroku[api]: Release v16 created by siansapp@gmail.com
2015-08-01T21:45:49.851010+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-01T21:45:49.851031+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-01T21:45:50.004462+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:45:54.795134+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 47602 -e production`
2015-08-01T21:45:56.708360+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T21:45:57.601818+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:45:57.618731+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:45:57.619677+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:46:03.819972+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 53934 -e production`
2015-08-01T21:46:05.753194+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T21:46:06.667354+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:46:06.654482+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:55:10.297772+00:00 heroku[api]: Deploy a4b04cd by siansapp@gmail.com
2015-08-01T21:55:10.297772+00:00 heroku[api]: Release v17 created by siansapp@gmail.com
2015-08-01T21:55:10.377020+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-01T21:55:10.377040+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-01T21:55:11.095268+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:55:17.864626+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2015-08-01T21:55:19.872652+00:00 app[web.1]: bash: bundle: command not found
2015-08-01T21:55:20.725657+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:55:20.706419+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:55:23.296769+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=jump-start-app.herokuapp.com request_id=d3b63340-8bea-4f1b-b682-542cd03a6ff3 fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T21:55:23.641812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jump-start-app.herokuapp.com request_id=1b7b38b2-1a63-4738-bb11-743b0a542a62 fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T21:57:03.013725+00:00 heroku[api]: Deploy 91324fa by siansapp@gmail.com
2015-08-01T21:57:03.013725+00:00 heroku[api]: Release v18 created by siansapp@gmail.com
2015-08-01T21:57:03.077639+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-01T21:57:03.077656+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-01T21:57:03.900413+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:57:11.881058+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 19971 -e production`
2015-08-01T21:57:14.685026+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T21:57:15.586421+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:57:15.602383+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:57:15.603603+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-01T21:57:19.020926+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 16821 -e production`
2015-08-01T21:57:20.510190+00:00 app[web.1]: /usr/bin/env: ruby: No such file or directory
2015-08-01T21:57:21.248670+00:00 heroku[web.1]: Process exited with status 127
2015-08-01T21:57:21.267300+00:00 heroku[web.1]: State changed from starting to crashed
2015-08-01T21:57:22.437971+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=jump-start-app.herokuapp.com request_id=5ac6c7ec-1573-4682-8578-0ab7922e74c6 fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
2015-08-01T21:57:23.227534+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jump-start-app.herokuapp.com request_id=17bfa86d-e75c-49ac-b373-20b81e0eb1ba fwd="213.233.148.4" dyno= connect= service= status=503 bytes=
WARNING: Toolbelt v3.40.6 update available.

I've looked at other answers to the "/usr/bin/env: ruby: No such file or directory" error but I think the files in my bin are fine:

我查看了“/ usr / bin / env:ruby:没有这样的文件或目录”错误的其他答案,但我认为我的bin中的文件很好:

Bundle:

#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

Rails:

#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application',  __FILE__)
require_relative '../config/boot'
require 'rails/commands'

Rake:

#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

I've tried updating my bin anyway but that didn't help. I'm not sure what else to do. Any help would be greatly appreciated!

我还是尝试更新我的垃圾箱,但这没有帮助。我不知道还能做什么。任何帮助将不胜感激!

1 个解决方案

#1


0  

Had just this error, it drove me crazy for two days. Finally found it was due to bundling my rails app on Windows. If this is your case delete the Gemfile.lock and run bundleon an Unix OS. Then commit and deploy to Heroku.

只是这个错误,它让我疯狂了两天。终于发现它是由于在Windows上捆绑我的rails应用程序。如果是这种情况,请删除Gemfile.lock并在Unix OS上运行bundleon。然后提交并部署到Heroku。

Other symptoms: bundle, rails, and rake commands all returned => : No such file or directory00:00 app[worker.1]: /usr/bin/env: ruby

其他症状:bundle,rails和rake命令全部返回=>:没有这样的文件或目录00:00 app [worker.1]:/ usr / bin / env:ruby

#1


0  

Had just this error, it drove me crazy for two days. Finally found it was due to bundling my rails app on Windows. If this is your case delete the Gemfile.lock and run bundleon an Unix OS. Then commit and deploy to Heroku.

只是这个错误,它让我疯狂了两天。终于发现它是由于在Windows上捆绑我的rails应用程序。如果是这种情况,请删除Gemfile.lock并在Unix OS上运行bundleon。然后提交并部署到Heroku。

Other symptoms: bundle, rails, and rake commands all returned => : No such file or directory00:00 app[worker.1]: /usr/bin/env: ruby

其他症状:bundle,rails和rake命令全部返回=>:没有这样的文件或目录00:00 app [worker.1]:/ usr / bin / env:ruby