我正在将NodeJS应用程序推送到Heroku,我遇到了一些问题。我不确定如何阅读Heroku日志。
2016-07-18T18:19:23.502153+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-18T18:19:23.463735+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-07-18T18:19:23.501690+00:00 app[web.1]:
2016-07-18T18:19:23.470750+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-07-18T18:19:23.470555+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-07-18T18:19:24.483557+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-18T18:19:24.465624+00:00 heroku[web.1]: Process exited with status 1
2016-07-18T18:19:18.868841+00:00 heroku[api]: Release v5 created by erichoonpark@gmail.com
2016-07-18T18:19:18.868841+00:00 heroku[api]: Deploy 36cd263 by erichoonpark@gmail.com
2016-07-18T18:19:26.082030+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-cliffs-62925.herokuapp.com request_id=2db799a0-1173-472d-9621-0cdfd490815a fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T18:19:26.499799+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-cliffs-62925.herokuapp.com request_id=1ad258e8-33fa-4471-ac14-eaa2214faf23 fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T18:24:31.409135+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T18:24:32.987200+00:00 heroku[web.1]: Starting process with command `npm start`
2016-07-18T18:24:35.429453+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-07-18T18:24:35.432381+00:00 app[web.1]:
2016-07-18T18:24:35.433382+00:00 app[web.1]: npm ERR! missing script: start
2016-07-18T18:24:35.430105+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-07-18T18:24:35.431005+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-07-18T18:24:35.430432+00:00 app[web.1]: npm ERR! node v5.11.1
2016-07-18T18:24:35.433574+00:00 app[web.1]: npm ERR!
2016-07-18T18:24:35.442456+00:00 app[web.1]:
2016-07-18T18:24:35.442672+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-07-18T18:24:35.442799+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-18T18:24:35.433830+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-07-18T18:24:35.433722+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-07-18T18:47:31.621322+00:00 heroku[slug-compiler]: Slug compilation finished
2016-07-18T18:47:31.621302+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-18T18:47:31.627600+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T18:47:33.041005+00:00 heroku[web.1]: Starting process with command `node index.js`
2016-07-18T18:47:35.278819+00:00 app[web.1]: Mon, 18 Jul 2016 18:47:35 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T18:47:35.284045+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T18:47:35.284053+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T18:47:35.280182+00:00 app[web.1]: Mon, 18 Jul 2016 18:47:35 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T18:47:35.284058+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T18:47:35.295953+00:00 app[web.1]: Example app listening on port 3000!
2016-07-18T18:47:31.395863+00:00 heroku[api]: Release v6 created by erichoonpark@gmail.com
2016-07-18T18:47:31.395658+00:00 heroku[api]: Deploy 9ee3a07 by erichoonpark@gmail.com
2016-07-18T18:48:33.382425+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-07-18T18:48:33.382425+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-07-18T18:48:34.414129+00:00 heroku[web.1]: Process exited with status 137
2016-07-18T18:48:34.393614+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-18T18:48:34.394688+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T18:48:35.530171+00:00 heroku[web.1]: Starting process with command `node index.js`
2016-07-18T18:48:37.502265+00:00 app[web.1]: Mon, 18 Jul 2016 18:48:37 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T18:48:37.503289+00:00 app[web.1]: Mon, 18 Jul 2016 18:48:37 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T18:48:37.506367+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T18:48:37.506364+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T18:48:37.506349+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T18:48:37.516082+00:00 app[web.1]: Example app listening on port 3000!
2016-07-18T18:49:35.824495+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-07-18T18:49:35.824495+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-07-18T18:49:36.603925+00:00 heroku[web.1]: Process exited with status 137
2016-07-18T18:49:36.634651+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-18T18:49:40.052462+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-cliffs-62925.herokuapp.com request_id=f3d132b2-7176-4c96-8741-8dcac511ae50 fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T19:21:47.005099+00:00 heroku[web.1]: Starting process with command `node index.js`
2016-07-18T19:21:49.402121+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T19:21:49.399001+00:00 app[web.1]: Mon, 18 Jul 2016 19:21:49 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T19:21:49.414203+00:00 app[web.1]: Example app listening on port 3000!
2016-07-18T19:21:49.402120+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T19:21:49.397970+00:00 app[web.1]: Mon, 18 Jul 2016 19:21:49 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T19:21:49.402119+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T19:22:47.282455+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-07-18T19:22:47.282455+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-07-18T19:22:48.113755+00:00 heroku[web.1]: Process exited with status 137
2016-07-18T19:41:02.813761+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-18T19:41:02.813774+00:00 heroku[slug-compiler]: Slug compilation finished
2016-07-18T19:41:02.783295+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T19:41:04.124231+00:00 heroku[web.1]: Starting process with command `node index.js`
2016-07-18T19:41:06.466213+00:00 app[web.1]: Mon, 18 Jul 2016 19:41:06 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T19:41:06.467405+00:00 app[web.1]: Mon, 18 Jul 2016 19:41:06 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T19:41:06.472565+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T19:41:06.472582+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T19:41:06.472586+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T19:41:06.486293+00:00 app[web.1]: Example app listening on port 3000!
2016-07-18T19:42:04.661703+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-07-18T19:42:04.661703+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-07-18T19:42:05.435255+00:00 heroku[web.1]: Process exited with status 137
2016-07-18T19:42:05.420527+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-18T19:42:05.420527+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T19:42:10.271225+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T19:42:10.271228+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T19:42:10.271227+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T19:42:10.265508+00:00 app[web.1]: Mon, 18 Jul 2016 19:42:10 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T19:42:10.266756+00:00 app[web.1]: Mon, 18 Jul 2016 19:42:10 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T19:42:10.286725+00:00 app[web.1]: Example app listening on port 3000!
2016-07-18T19:43:07.348693+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-07-18T19:43:07.348693+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-07-18T19:43:08.477197+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-18T19:54:13.765384+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-cliffs-62925.herokuapp.com request_id=bd493067-f8e9-453c-8ca4-c5aca24748f9 fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T20:01:21.154282+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-cliffs-62925.herokuapp.com request_id=291f5190-4462-4a99-bcb4-80569ab5558b fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T20:01:22.818855+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-cliffs-62925.herokuapp.com request_id=300b91ef-df35-4b17-96cc-229669a042e7 fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T20:01:22.048774+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-cliffs-62925.herokuapp.com request_id=e38bb8bc-9cf4-4b19-bb59-672427782668 fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T20:01:30.199336+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-cliffs-62925.herokuapp.com request_id=aefaa1b2-64d4-42c2-85ef-22caafd1853d fwd="204.14.239.83" dyno= connect= service= status=503 bytes=
2016-07-18T20:04:15.921037+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-18T20:04:17.666514+00:00 heroku[web.1]: Starting process with command `node index.js`
2016-07-18T20:04:20.018227+00:00 app[web.1]: Mon, 18 Jul 2016 20:04:20 GMT express-session deprecated undefined resave option; provide resave option at index.js:52:9
2016-07-18T20:04:20.019957+00:00 app[web.1]: Mon, 18 Jul 2016 20:04:20 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:52:9
2016-07-18T20:04:20.024801+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2016-07-18T20:04:20.024809+00:00 app[web.1]: designed for a production environment, as it will leak
2016-07-18T20:04:20.024814+00:00 app[web.1]: memory, and will not scale past a single process.
2016-07-18T20:04:20.036151+00:00 app[web.1]: Example app listening on port 3000!
我收到此错误,然后在加载页面时出现“应用程序错误”页面。这是我的其他代码:
的package.json
{
"name": "import-tool",
"version": "1.0.0",
"description": "A tool for importing CSV",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.15.2",
"cookie-parser": "^1.4.3",
"express": "^4.14.0",
"express-session": "^1.14.0",
"papaparse": "^4.1.2",
"passport": "^0.3.2",
"passport-deskcom": "0.0.2",
"request": "^2.72.0"
},
"engines": {
"node": "4.1.1"
}
}
答案 0 :(得分:0)
在收听端口时,在index.js文件中,需要让服务器监听process.env.PORT 即, .listen(process.env.PORT || 5000)