4
NPM開始退出將開始我的應用程序就好了,但是當我這樣做:PM2開始app.js之後重啓15
pm2 start app.js
我得到:
[PM2] Spawning PM2 daemon
[PM2] PM2 Successfully daemonized
[PM2] Process app.js launched
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ app │ 0 │ fork │ 4681 │ online │ 0 │ 0s │ 11.508 MB │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
在日誌中我得到:
[PM2] Starting streaming logs for [all] process
PM2: 2015-06-04 17:12:37: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:37: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:37: App name:app id:0 online
PM2: 2015-06-04 17:12:37: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:37: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:37: App name:app id:0 online
PM2: 2015-06-04 17:12:37: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:37: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:37: App name:app id:0 online
PM2: 2015-06-04 17:12:38: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:38: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:38: App name:app id:0 online
PM2: 2015-06-04 17:12:38: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:38: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:38: App name:app id:0 online
PM2: 2015-06-04 17:12:39: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:39: Starting execution sequence in -fork mode- for app name:app id:0
PM2: 2015-06-04 17:12:39: App name:app id:0 online
PM2: 2015-06-04 17:12:39: App name:app id:0 exited with code 0
PM2: 2015-06-04 17:12:39: Script /home/user/app/app.js had too many unstable restarts (15). Stopped. "errored"
這裏是我的package.json:
1 {
2 "name": "app",
3 "version": "0.0.0",
4 "private": true,
5 "scripts": {
6 "start": "node ./bin/www"
7 },
8 "dependencies": {
9 "body-parser": "~1.12.4",
10 "cookie-parser": "~1.3.5",
11 "debug": "~2.2.0",
12 "express": "~4.12.4",
13 "jade": "~1.9.2",
14 "morgan": "~1.5.3",
15 "serve-favicon": "~2.2.1",
16 "stylus": "0.42.3"
17 }
18 }
節點版本:v0.10.38 PM2版本:0.12.15
我怎麼連調試這個?我不確定它爲什麼會失敗,還有其他地方需要檢查嗎?我的app.js文件?
所以節點app.js沒有做任何事情 - 參考http:// stackoverflow.com/questions/22215592/default-node-js-express-js-does-not-run – cakes88
我剛更新了我的答案。 'npm start'和'node app.js'啓動兩個不同的文件。這就是爲什麼'node app.js'似乎什麼都不做。相反,你可以做'node。/ bin/www',它應該以'npm start'的方式啓動。 – Randy
我想吻你 - 謝謝 – cakes88