简体   繁体   English

Node.js应用程序在本地运行,但在Heroku上失败

[英]Node.js app runs locally but fails on Heroku

I have a Node.js app that runs perfectly locally, however as soon as I push it to Heroku the app refuses to start. 我有一个可以在本地完美运行的Node.js应用程序,但是一旦将其推送到Heroku,该应用程序就会拒绝启动。 I ran heroku logs and it shows that the server is up and is listening on a port. 我运行了heroku logs ,它显示服务器已启动并且正在侦听端口。 It also says the process exited with status 22 at the bottom. 它还说该进程以底部的status 22退出。 The Heroku docs state that the Connection Limit Reached but I'm not too sure what that means. Heroku文档指出Connection Limit Reached但我不太确定这意味着什么。 Can anyone point me in the right direction of what's going on? 谁能指出我正在发生的正确方向?

Here's the Github repo: https://github.com/andrewgu12/MVInteract The Heroku app: http://mvinteract.herokuapp.com/ 这是Github仓库: https : //github.com/andrewgu12/MVInteract Heroku应用程序: http : //mvinteract.herokuapp.com/

2014-08-30T01:39:28.096394+00:00 heroku[router]: at=info method=GET path="/javascripts/jquery.js" host=mvinteract.herokuapp.com request_id=a29c3b15-c3ab-4dbf-9773-3c5e97329bb0 fwd="129.2.129.222" dyno=web.1 connect=1ms service=125ms status=200 bytes=771
2014-08-30T01:39:28.907226+00:00 heroku[router]: at=info method=GET path="/images/IMG_9771.jpg" host=mvinteract.herokuapp.com request_id=b9e6c7b1-2c36-4c02-b23e-e6f08841bce4 fwd="129.2.129.222" dyno=web.1 connect=2ms service=290ms status=200 bytes=786
2014-08-30T01:39:28.829830+00:00 app[web.1]: ←[90mGET /images/IMG_9771.jpg ←[32m200 ←[90m220ms - 2.34mb←[0m
2014-08-30T01:49:33+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-30T01:49:56+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-30T01:49:56.635217+00:00 heroku[api]: Deploy db9ac78 by andrew@mingbogu.com
2014-08-30T01:49:56.635287+00:00 heroku[api]: Release v24 created by andrew@mingbogu.com
2014-08-30T01:49:56.922603+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T01:49:59.782636+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2014-08-30T01:49:59.221476+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T01:50:00.440881+00:00 heroku[web.1]: Process exited with status 22
2014-08-30T01:50:01.159538+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T01:50:02.382946+00:00 app[web.1]:
2014-08-30T01:50:02.382965+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T01:50:02.382967+00:00 app[web.1]: > node ./bin/www
2014-08-30T01:50:02.382968+00:00 app[web.1]:
2014-08-30T01:50:02.880451+00:00 app[web.1]: Express server listening on port 33597 in development mode
2014-08-30T01:50:03.286246+00:00 heroku[web.1]: State changed from starting to up
2014-08-30T01:51:33.748521+00:00 app[web.1]: Warning: missing space before text for line 30 of jade file "/app/views/index.jade"
2014-08-30T01:51:33.853370+00:00 heroku[router]: at=info method=HEAD path="/" host=mvinteract.herokuapp.com request_id=852fabd8-cf7b-4c57-9f25-9f7c09fd4692 fwd="50.97.161.229" dyno=web.1 connect=1ms service=644ms status=200 bytes=360
2014-08-30T01:51:33.851299+00:00 app[web.1]: ←[90mHEAD / ←[32m200 ←[90m639ms - 1.39kb←[0m
2014-08-30T02:08:58+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-30T02:09:22+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-30T02:09:22.747726+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T02:09:22.641841+00:00 heroku[api]: Release v25 created by andrew@mingbogu.com
2014-08-30T02:09:22.641775+00:00 heroku[api]: Deploy d928c6a by andrew@mingbogu.com
2014-08-30T02:09:25.111625+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T02:09:25.749566+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2014-08-30T02:09:26.438990+00:00 heroku[web.1]: Process exited with status 22
2014-08-30T02:09:28.008233+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T02:09:29.138444+00:00 app[web.1]:
2014-08-30T02:09:29.138464+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T02:09:29.138467+00:00 app[web.1]:
2014-08-30T02:09:29.138466+00:00 app[web.1]: > node ./bin/www
2014-08-30T02:09:29.757517+00:00 app[web.1]: Express server listening on port 41644 in development mode
2014-08-30T02:09:30.107275+00:00 heroku[web.1]: State changed from starting to up
2014-08-30T02:12:19+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-30T02:12:43+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-30T02:12:43.900570+00:00 heroku[api]: Deploy 20592aa by andrew@mingbogu.com
2014-08-30T02:12:43.900570+00:00 heroku[api]: Release v26 created by andrew@mingbogu.com
2014-08-30T02:12:44.462142+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T02:12:46.776970+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T02:12:48.148454+00:00 heroku[web.1]: Process exited with status 143
2014-08-30T02:12:50.014282+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T02:12:51.548957+00:00 app[web.1]:
2014-08-30T02:12:51.548977+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T02:12:51.548979+00:00 app[web.1]: > nodemon ./bin/www
2014-08-30T02:12:51.548980+00:00 app[web.1]:
2014-08-30T02:12:52.306384+00:00 app[web.1]: 30 Aug 02:12:52 - ←[33m[nodemon] watching: *.*←[39m
2014-08-30T02:12:52.304804+00:00 app[web.1]: 30 Aug 02:12:52 - ←[33m[nodemon] v1.2.1←[39m
2014-08-30T02:12:52.306150+00:00 app[web.1]: 30 Aug 02:12:52 - ←[33m[nodemon] to restart at any time, enter `rs`←[39m
2014-08-30T02:12:52.306717+00:00 app[web.1]: 30 Aug 02:12:52 - ←[32m[nodemon] starting `node ./bin/www`←[39m
2014-08-30T02:12:54.252363+00:00 app[web.1]: Express server listening on port 59874 in development mode
2014-08-30T02:12:54.779441+00:00 heroku[web.1]: State changed from starting to up
2014-08-30T02:16:41+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-30T02:17:03+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-30T02:17:03.220456+00:00 heroku[api]: Deploy 5164e80 by andrew@mingbogu.com
2014-08-30T02:17:03.220534+00:00 heroku[api]: Release v27 created by andrew@mingbogu.com
2014-08-30T02:17:03.475831+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T02:17:06.416837+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T02:17:08.640550+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T02:17:09.665142+00:00 app[web.1]:
2014-08-30T02:17:09.665164+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T02:17:09.665166+00:00 app[web.1]: > nodemon ./bin/www
2014-08-30T02:17:09.665168+00:00 app[web.1]:
2014-08-30T02:17:10.261399+00:00 app[web.1]: 30 Aug 02:17:10 - ←[33m[nodemon] to restart at any time, enter `rs`←[39m
2014-08-30T02:17:10.262080+00:00 app[web.1]: 30 Aug 02:17:10 - ←[32m[nodemon] starting `node ./bin/www`←[39m
2014-08-30T02:17:10.261687+00:00 app[web.1]: 30 Aug 02:17:10 - ←[33m[nodemon] watching: *.*←[39m
2014-08-30T02:17:10.257488+00:00 app[web.1]: 30 Aug 02:17:10 - ←[33m[nodemon] v1.2.1←[39m
2014-08-30T02:17:11.347078+00:00 app[web.1]: Express server listening on port 30970 in development mode
2014-08-30T02:17:11.423826+00:00 heroku[web.1]: State changed from starting to up
2014-08-30T02:17:15.558081+00:00 heroku[web.1]: Process exited with status 143
2014-08-30T02:24:31.443643+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T02:24:34.687156+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T02:24:35.450601+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T02:24:36.083997+00:00 heroku[web.1]: Process exited with status 143
2014-08-30T02:24:36.618400+00:00 app[web.1]:
2014-08-30T02:24:36.618418+00:00 app[web.1]: > nodemon ./bin/www
2014-08-30T02:24:36.618416+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T02:24:36.618419+00:00 app[web.1]:
2014-08-30T02:24:37.098105+00:00 app[web.1]: 30 Aug 02:24:37 - ←[33m[nodemon] watching: *.*←[39m
2014-08-30T02:24:37.096652+00:00 app[web.1]: 30 Aug 02:24:37 - ←[33m[nodemon] v1.2.1←[39m
2014-08-30T02:24:37.098421+00:00 app[web.1]: 30 Aug 02:24:37 - ←[32m[nodemon] starting `node ./bin/www`←[39m
2014-08-30T02:24:37.097904+00:00 app[web.1]: 30 Aug 02:24:37 - ←[33m[nodemon] to restart at any time, enter `rs`←[39m
2014-08-30T02:24:37.603499+00:00 app[web.1]: Express server listening on port 53939 in development mode
2014-08-30T02:24:37.881966+00:00 heroku[web.1]: State changed from starting to up
2014-08-30T02:27:00+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-30T02:27:24+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-30T02:27:24.692702+00:00 heroku[api]: Deploy 93109ca by andrew@mingbogu.com
2014-08-30T02:27:24.692862+00:00 heroku[api]: Release v28 created by andrew@mingbogu.com
2014-08-30T02:27:25.183363+00:00 heroku[web.1]: State changed from up to starting
2014-08-30T02:27:27.733184+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2014-08-30T02:27:27.223544+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-30T02:27:28.433388+00:00 heroku[web.1]: Process exited with status 22
2014-08-30T02:27:30.623847+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-30T02:27:31.727492+00:00 app[web.1]:
2014-08-30T02:27:31.727513+00:00 app[web.1]: > node ./bin/www
2014-08-30T02:27:31.727512+00:00 app[web.1]: > mvinteract@0.0.1 start /app
2014-08-30T02:27:31.727515+00:00 app[web.1]:
2014-08-30T02:27:32.420283+00:00 app[web.1]: Express server listening on port 51720 in development mode
2014-08-30T02:27:32.735309+00:00 heroku[web.1]: State changed from starting to up

I've pulled your code and had a look around. 我已经提取了您的代码并四处张望。 As you stated running locally (with foreman) seems to work fine. 正如您所说的,在本地(由领班)跑步似乎很好。

Can I suggest that in your /bin/www script that you add some more console logs to see if the whole thing is succeeding and perhaps capture the SIGTERM signal as documented here 我是否可以建议您在/ bin / www脚本中添加更多控制台日志,以查看整个过程是否成功,并且可以捕获SIGTERM信号,如此处所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM