Reputation: 95
I have install pm2 globally
sudo pm2 install -g
pm2 start server.js
pm2 status (gives this output) ┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬─────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼─────────┼──────────┤ │ server │ 0 │ fork │ 10094 │ online │ 0 │ 85s │ 0% │ 44.7 MB │ ubuntu │ disabled │ └──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴─────────┴──────────┘
When pm2 log 0 we get following error
1|server | 2018-01-23 14:35 +00:00: Tue, 23 Jan 2018 14:35:03 GMT zap2it:server Server now running on localhost:4040
1|server | 2018-01-23 14:35 +00:00: Tue, 23 Jan 2018 14:35:03 GMT zap2it:server spawning worker #53
1|server | 2018-01-23 14:35 +00:00: EPERM, Operation not permitted on call initgroups
1|server | 2018-01-23 14:35 +00:00: ubuntu is not accessible
What permission I need for pm2 to run or where I can look for errors? Can I install and run pm2 using root?
Upvotes: 0
Views: 5842
Reputation: 11
I solved this issue on windows by going to the services and stop the pm2 service from running and at my terminal, I did the pm2 start app.js and everything ran fine
Upvotes: 1
Reputation: 31
you must execute pm2 update like:
sudo npm install -g pm2
pm2 update
pm2 start server.js
Upvotes: 3
Reputation: 158
PM2 logs can be found at <HOME>/.pm2/logs/
and you should be able to install and run it using root, although this is not recommended (as stated in the comments by savior123).
I've just run into the same issue and error messages as you a while ago - although not running PM2 with sudo
- and solved it by updating PM2 version (from 2.9.2 to 2.9.3), as commented by Unitech
Upvotes: 2