node.js - pm2 start app.js is exiting after 15 restarts -
npm start start app fine when do:
pm2 start app.js
i get:
[pm2] spawning pm2 daemon [pm2] pm2 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>` more details app
in logs get:
[pm2] starting streaming logs [all] process pm2: 2015-06-04 17:12:37: app name:app id:0 exited code 0 pm2: 2015-06-04 17:12:37: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:37: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:37: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:38: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:38: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:39: starting execution sequence in -fork mode- 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 code 0 pm2: 2015-06-04 17:12:39: script /home/user/app/app.js had many unstable restarts (15). stopped. "errored"
here 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 }
node version: v0.10.38 pm2 version: 0.12.15
how debug this? not sure why it's failing, there other place need check? app.js file?
first, i'd try node ./bin/www
, make sure works correctly.
i'm not sure "official" way figure out should work:
put uncaught exception handler code writes file or else.
process.on('uncaughtexception', function(err) { console.log('caught exception: ' + err); throw err; });
edit: based on comment reason you're having issues because app.js
not real entry point in application. real entry point ./bin/www
so need tell pm2 start file rather app.js
this:
pm2 start ./bin/www
Comments
Post a Comment