pm2 start app.js is exiting after 15 restarts - node.js

npm start will start my app just fine but when I do:
pm2 start app.js
I get:
[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
in the logs I get:
[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"
here is my 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 do I even debug this? I am not sure why it's failing, is there some other place I need to check? My app.js file?

First, I'd try node ./bin/www and just make sure that works correctly.
I'm not sure what the "official" way to figure this out is but this should work:
You could put an uncaught exception handler into your code which simply writes to a file or do something else.
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
throw err;
});
Edit:
Based on your comment the reason you're having issues is because app.js is not the real entry point in your application. The real entry point is ./bin/www
So you need to tell PM2 to start that file rather than app.js like this:
pm2 start ./bin/www

Related

Build folder not recognized in pm2 service

I'm running my node+react app on vps ubuntu machine using ssh.
I used nginx, pm2 for running my node js server, but when I check my logs it shows the following error:
App [server:0] starting in -fork mode-
PM2 | 2020-09-16T07:05:03: PM2 log: App [server:0] online
PM2 | 2020-09-16T07:06:18: PM2 log: Reloading logs...
PM2 | 2020-09-16T07:06:18: PM2 log: Reloading logs for process id 0
PM2 | 2020-09-16T07:38:58: PM2 log: Stopping app:server id:0
PM2 | 2020-09-16T07:38:58: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2 | 2020-09-16T07:38:58: PM2 log: pid=6888 msg=process killed
PM2 | 2020-09-16T07:38:58: PM2 log: App [server:0] starting in -fork mode-
PM2 | 2020-09-16T07:38:58: PM2 log: App [server:0] online
0|server | Error: ENOENT: no such file or directory, stat '/root/repos/IRS-Ecommerce/IRS-
Ecommerce/build/index.html'
/root/.pm2/logs/server-out.log last 15 lines:
0|server | Server is up and running at port : 8080
0|server | MongoDB connected successfully!
My node js server file where I'm sending my react app in response:
app.use(express.static("IRS-Ecommerce/build"));
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "IRS-Ecommerce", "build", "index.html"));
});
I've run npm build in my react app and build folder is present there, but it is showing this error that index.html is not there. I've checked the path, it is correct.
When I access public IP, my react app shows up which means it is working. But why am I seeing this error here?
/root/repos/IRS-Ecommerce/IRS- Ecommerce/build/index.html double IRS-
Ecommerce orz

Node app stops responding after some time

I recently pushed my node js and express server to the production.
After a few days of working on the production, I realized that sometimes with no reason my server stops responding for requests.
[31/Dec/2018:09:55:39 +0000] "GET /vehicles?user_lat=52.458876&user_lng=16.9006237 HTTP/1.1" - - ms
I was looking for an answer here but the only advice I found was to debug server and find out what is causing it crashes. Unfortunately, I am not able to find out where is the problem. I added listeners to the process to find unhandled promises rejection and uncaught exception but nothing was caught.
What I also found is when the server stops responding the CPU usage is
running high. Normally it takes 1-5%, but when it hangs it is around 20%.
The next strange thing for me is the output of pm2.log file. According to it, my server often restarts but I don't understand why.
pm2.log file:
2018-12-22T10:12:10: PM2 log: pid=28427 msg=process killed
2018-12-22T10:12:10: PM2 log: App [server:0] starting in -fork mode-
2018-12-22T10:12:10: PM2 log: App [server:0] online
2018-12-24T13:33:40: PM2 log: Stopping app:server id:0
2018-12-24T13:33:40: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-24T13:33:41: PM2 log: pid=31380 msg=process killed
2018-12-24T13:33:41: PM2 log: App [server:0] starting in -fork mode-
2018-12-24T13:33:41: PM2 log: App [server:0] online
2018-12-24T13:45:29: PM2 log: Stopping app:server id:0
2018-12-24T13:45:29: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-24T13:45:29: PM2 log: pid=5521 msg=process killed
2018-12-24T13:45:29: PM2 log: App [server:0] starting in -fork mode-
2018-12-24T13:45:29: PM2 log: App [server:0] online
2018-12-25T03:11:40: PM2 log: Stopping app:server id:0
2018-12-25T03:11:40: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-25T03:11:40: PM2 log: pid=6049 msg=process killed
2018-12-25T03:11:40: PM2 log: App [server:0] starting in -fork mode-
2018-12-25T03:11:40: PM2 log: App [server:0] online
2018-12-27T05:07:30: PM2 log: Stopping app:server id:0
2018-12-27T05:07:30: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-27T05:07:30: PM2 log: pid=11531 msg=process killed
2018-12-27T05:07:30: PM2 log: App [server:0] starting in -fork mode-
2018-12-27T05:07:30: PM2 log: App [server:0] online
2018-12-29T08:08:27: PM2 log: Stopping app:server id:0
2018-12-29T08:08:27: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-29T08:08:27: PM2 log: pid=28263 msg=process killed
2018-12-29T08:08:27: PM2 log: App [server:0] starting in -fork mode-
2018-12-29T08:08:27: PM2 log: App [server:0] online
2018-12-29T09:41:23: PM2 log: Stopping app:server id:0
2018-12-29T09:41:23: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-29T09:41:23: PM2 log: pid=11341 msg=process killed
2018-12-29T09:41:23: PM2 log: App [server:0] starting in -fork mode-
2018-12-29T09:41:23: PM2 log: App [server:0] online
2018-12-31T10:03:33: PM2 log: Stopping app:server id:0
2018-12-31T10:03:33: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-31T10:03:33: PM2 log: pid=12337 msg=process killed
2018-12-31T10:03:33: PM2 log: App [server:0] starting in -fork mode-
2018-12-31T10:03:33: PM2 log: App [server:0] online
2018-12-31T10:48:51: PM2 log: Stopping app:server id:0
2018-12-31T10:48:51: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2018-12-31T10:48:51: PM2 log: pid=28552 msg=process killed
2018-12-31T10:48:51: PM2 log: App [server:0] starting in -fork mode-
2018-12-31T10:48:51: PM2 log: App [server:0] online
On the production, I use pm2 to start my server.
Here is my server.js file:
var express = require('express'),
app = express(),
port = process.env.PORT || 3000;
const morgan = require('morgan');
const routes = require('./api/routes/main_routes');
const authMiddleware = require('./api/authorization/auth');
bodyParser = require('body-parser');
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url
HTTP/:http-version" :status :response-time ms'))
app.use('/images', express.static(__dirname + '/markers'));
app.use('/cars', express.static(__dirname + '/cars'));
app.use('/video', express.static(__dirname + '/video'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(authMiddleware)
routes(app); //register the routes
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.send(err.message);
});
process.on('unhandledRejection', (reason, p) => {
console.log("Unhandled Rejection at: Promise ", p, " reason: ",
reason);
});
process.on('uncaughtException', function (exception) {
console.log(exception);
});
app.listen(port);
console.log('server started on:' + port);
And package.json file:
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "nodemon server.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^1.11.0"
},
"dependencies": {
"axios": "^0.18.0",
"axios-cache-adapter": "^2.1.1",
"body-parser": "^1.17.2",
"cachios": "^2.0.0",
"cors": "^2.8.4",
"express": "^4.15.4",
"file-system": "^2.2.2",
"form-data": "^2.3.3",
"geolib": "^2.0.24",
"lodash": "^4.17.4",
"morgan": "^1.9.1",
"nodemon": "^1.18.6",
"path": "^0.12.7",
"sharp": "^0.18.4",
"websocket": "^1.0.28"
}
}
Full pm2 logs
/root/.pm2/pm2.log last 15 lines:
PM2 | 2018-12-29T09:41:23: PM2 log: Stopping app:server id:0
PM2 | 2018-12-29T09:41:23: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2 | 2018-12-29T09:41:23: PM2 log: pid=11341 msg=process killed
PM2 | 2018-12-29T09:41:23: PM2 log: App [server:0] starting in -fork mode-
PM2 | 2018-12-29T09:41:23: PM2 log: App [server:0] online
PM2 | 2018-12-31T10:03:33: PM2 log: Stopping app:server id:0
PM2 | 2018-12-31T10:03:33: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2 | 2018-12-31T10:03:33: PM2 log: pid=12337 msg=process killed
PM2 | 2018-12-31T10:03:33: PM2 log: App [server:0] starting in -fork mode-
PM2 | 2018-12-31T10:03:33: PM2 log: App [server:0] online
PM2 | 2018-12-31T10:48:51: PM2 log: Stopping app:server id:0
PM2 | 2018-12-31T10:48:51: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2 | 2018-12-31T10:48:51: PM2 log: pid=28552 msg=process killed
PM2 | 2018-12-31T10:48:51: PM2 log: App [server:0] starting in -fork mode-
PM2 | 2018-12-31T10:48:51: PM2 log: App [server:0] online
/root/.pm2/logs/server-error.log last 15 lines:
/root/.pm2/logs/server-out.log last 15 lines:
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:27 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.849 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:27 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.667 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:27 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.567 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:28 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 1.065 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:28 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 1.302 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:28 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 0.550 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:28 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 0.566 ms
0|server | 211
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:30 +0000] "GET /vehicles?user_lat=52.14601814935841&user_lng=21.04796773265618&center_lng=21.047964502570746&center_lat=52.14602095031964 HTTP/1.1" 200 5357.940 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.624 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.613 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 0.600 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 0.520 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_active.png HTTP/1.1" 200 0.567 ms
0|server | ::ffff:127.0.0.1 - - [31/Dec/2018:16:11:31 +0000] "GET /images/marker_inactive.png HTTP/1.1" 200 0.416 ms

pm2 running at 100% CPU - how to debug

Last couple of weeks, I am struggling with pm2 100% CPU usage which hangs my node server.
I tried reading logs but I didn't find any issue there.
My node version: 6.9.1
PM2 is : 2.4.4.
OS: Ubuntu 14.04
On an average my cpu usage is : ~5
Manually I am restarting all apps - pm2 restart all.
pm2.log:
fluid_admin#instance-2:~$ tail -15 .pm2/pm2.log
2017-04-12 09:55:30: Starting execution sequence in -fork mode- for app name:fluid-prod id:0
2017-04-12 09:55:30: App name:fluid-prod id:0 online
2017-04-14 13:53:21: Stopping app:fluid-prod id:0
2017-04-14 13:53:21: Stopping app:nedbserver id:1
2017-04-14 13:53:21: App [nedbserver] with id [1] and pid [32557], exited with code [0] via signal [SIGINT]
2017-04-14 13:53:21: pid=32574 msg=failed to kill - retrying in 100ms
2017-04-14 13:53:21: pid=32557 msg=process killed
2017-04-14 13:53:21: Starting execution sequence in -fork mode- for app name:nedbserver id:1
2017-04-14 13:53:21: App [fluid-prod] with id [0] and pid [32574], exited with code [0] via signal [SIGINT]
2017-04-14 13:53:21: App name:nedbserver id:1 online
2017-04-14 13:53:21: pid=32574 msg=process killed
2017-04-14 13:53:21: Starting execution sequence in -fork mode- for app name:fluid-prod id:0
2017-04-14 13:53:21: App name:fluid-prod id:0 online
App is running on GAE, OS is : Ubuntu 14.04.
My CPU usage when PM2 is high
I have moved from forever to pm2 6 months back. till recent time, it was working file but now I am frequently having this issue.
I don't know deal this problem. Can some one help me how to debug this issue.
It happened again. Output of TOP commands
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
25059 fluid_a+ 20 0 1260364 105532 8236 R 99.7 17.5 58:27.27 node fluid/server/tools/www +
1 root 20 0 33520 3208 1792 S 0.0 0.5 0:04.82 /sbin/init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd]
Script to start my app:
pm2 stop fluid-prod
pm2 start \
-n fluid-prod \
-e /path/to/fluid-error.log \
-o /path/to/fluid-out.log \
$(dirname $0)/www -- --max-memory-restart 200M --env=production

Node.js pm2 keeps restarting almost every second

I have deployed an express.js app on a Azure server. I use pm2 for process management.
The issue is pm2 keeps restarting almost every seconds.
staging#Server:/srv/apps/myapp/current$ pm2 list
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ app │ 0 │ fork │ 35428 │ online │ 0 │ 0s │ 20.465 MB │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
staging#Server:/srv/apps/myapp/current$ pm2 list
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ app │ 0 │ fork │ 35492 │ online │ 7 │ 0s │ 59.832 MB │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
staging#Server:/srv/apps/myapp/current$ pm2 list
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ app │ 0 │ fork │ 35557 │ online │ 13 │ 0s │ 21.816 MB │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
~/.pm2/pm2.log
2016-05-10 17:39:34: Starting execution sequence in -fork mode- for app name:start id:0
2016-05-10 17:39:34: App name:start id:0 online
2016-05-10 17:39:35: App [start] with id [0] and pid [3149], exited with code [255] via signal [SIGINT]
2016-05-10 17:39:35: Starting execution sequence in -fork mode- for app name:start id:0
2016-05-10 17:39:35: App name:start id:0 online
2016-05-10 17:39:35: App [start] with id [0] and pid [3158], exited with code [255] via signal [SIGINT]
2016-05-10 17:39:35: Starting execution sequence in -fork mode- for app name:start id:0
2016-05-10 17:39:35: App name:start id:0 online
2016-05-10 17:39:36: App [start] with id [0] and pid [3175], exited with code [255] via signal [SIGINT]
2016-05-10 17:39:36: Starting execution sequence in -fork mode- for app name:start id:0
I am using coffee script in my application. And starting the app using pm2 start app.coffee
package.json
{
"name": "myapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "gulp start-server"
},
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "~1.13.2",
"co": "^4.6.0",
"coffee-script": "^1.10.0",
"connect-mongo": "^1.1.0",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"express-session": "^1.13.0",
"gulp": "^3.9.1",
"mongoose": "^4.4.14",
"morgan": "~1.6.1",
"newrelic": "^1.26.2",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"pm2": "^1.1.3",
"pug": "^2.0.0-alpha6",
"request": "^2.72.0",
"serve-favicon": "~2.3.0"
},
"devDependencies": {
"shipit-cli": "^1.4.1",
"shipit-deploy": "^2.1.3",
"shipit-npm": "^0.2.0",
"shipit-pm2-nginx": "^0.1.8"
}
}
I am new to node.js. May be I am not seeing the obvious. Please help me out.
Check if your app modifies a file in the project folder (such as a log file). A change to any of the files triggers restart if watch flag is enabled.
To prevent this, use a process file and add watch_ignore flag in it.
Here's a documentation on how to use the process file:
PM2 - Process File
pm2 writes application logs to ~/.pm2/logs and pm2 specific logs to pm2.log by default. We need to check both the locations to debug the issue.
One other way to debug application is by starting the application manually, ie., something like npm run start or node path/yo/your/bin.js
It should give you the missing piece of information to fix the problem and move on.
We also faced a similar problem where pm2 was restarting a process to start a node.js web application almost every second.
We found that MongoDB was not running, and then the web application would try to connect to the database on start up but would fail. This would prompt pm2 to restart the process over and over, causing a restart every second.
If this is your issue, try to start MongoDB with mongod or mongod --dbpath [your db path]?
Applicable if you have packaged and started your app with NPM.
I simply had to change the "script" file in the ecosystem.configure.js ( or the json file if you are using ).
app.js will not work, I had to replace it with ./bin/www and then it worked.
Be sure to look at the logs to see what is going wrong (pm2 describe {process} will show you where they are saved). Also, see if you can run the express app without pm2 by stopping the pm2 process and running your app manually (i.e. npm run start).
If you can run the app manually but it doesn't work with pm2, it might be that the app is not being run from the correct directory (you can modify this with the pm2 cwd argument).
Another common issue is that the correct environment variables are not set, so check your json or ecosystem file. You can also look at the environment that pm2 is running with pm2 prettylist.
I know this is kinda late and everything but for anyone scrolling over this, I found n actual solution, after hours of researching.
So I wanted to share this cheatsheet found: https://devhints.io/pm2
pm2 start app.js --no-autorestart
Just ran into this error too. I ran dmesg and that told me my process was getting killed by the Linux kernel, as it was using more memory than I had given the Docker container it was running inside.
Allocating more memory to the container fixed the problem in this case.

node-sails app is getting stop in every 24 hours or earlier on server

I have two sails js apps on two servers but my both apps on one server are getting stop in every 24 hours, I usually check both the app in the morning and it shows the following after running
pm2 list or pm2 restart all:-
[PM2] Spawning PM2 daemon
[PM2] PM2 Successfully daemonized
[PM2][WARN] No process found
and every time I had to go to their directory and run the command:- pm2 start app.js individually, but both the apps on another server are working correctly.
Please suggest what should I do?
Thanks
Now my service is stoped and after running pm2 logs its showing:
[PM2] Spawning PM2 daemon
[PM2] PM2 Successfully daemonized
########### Starting streaming logs for [all] process
Can not find log files, try to reload logs by executing "pm2 reload <name|all>".
PM2: 2015-07-17 03:27:22: App name:app id:0 online
PM2: child_process.js:935
PM2: throw errnoException(process._errno, 'spawn');
PM2: ^
PM2: Error: spawn ENOMEM
PM2: at errnoException (child_process.js:988:11)
PM2: at ChildProcess.spawn (child_process.js:935:11)
PM2: at exports.spawn (child_process.js:723:9)
PM2: at Object.exports.execFile (child_process.js:607:15)
PM2: at exports.exec (child_process.js:578:18)
PM2: at Object.parseHg [as parse] (/usr/local/lib/node_modules/pm2/node_modules/vizion/lib/hg.js:36:2)
PM2: at /usr/local/lib/node_modules/pm2/node_modules/vizion/lib/vizion.js:16:24
PM2: at /usr/local/lib/node_modules/pm2/node_modules/vizion/lib/identify.js:18:12
PM2: at /usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:151:21
PM2: at /usr/local/lib/node_modules/pm2/node_modules/vizion/lib/identify.js:12:16
PM2: 2015-07-20 06:23:46: [PM2][WORKER] Started with refreshing interval: 30000
PM2: 2015-07-20 06:23:46: [[[[ PM2/God daemon launched ]]]]
PM2: 2015-07-20 06:23:46: BUS system [READY] on port /root/.pm2/pub.sock
PM2: 2015-07-20 06:23:46: RPC interface [READY] on port /root/.pm2/rpc.sock
and after running pm2 list or pm2 restart all its showing:
[PM2] Spawning PM2 daemon
[PM2] PM2 Successfully daemonized
[PM2][WARN] No process found
plz help I am totally stuck in this.
Thanks

Resources