pm2 not starting my NodeJS web app

June 19, 2015 12.3k views

Hello this is my first time working with a VPS. I’ve managed to follow the instructions from this tutorial but once I reached the “Manage Application with PM2” everything stopped working. Basically my web app works when I run “node index.js” (index.js being where my express app starts) but when I try “pm2 start index.js” it says it’s started but I can’t reach it from my browser. It says it’s online but it’s not. Help please.

3 Answers

For anyone having this issue, I solved it by appending some required node parameters.

Mine looked like this: pm2 start app.js --node-args="--harmony-destructuring --harmony_rest_parameters"

You may need to pass in some required arguments. Check package.json for a start script.

There some issue with digital ocean server.
I can start server with pm2 start app.js
[PM2] Applying action restartProcessId on app [app](ids: 0)
[PM2] [app](0) ✓
[PM2] Process successfully started
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
│ app │ 0 │ 0.0.0 │ fork │ 23428 │ online │ 5 │ 0s │ 0% │ 4.7 MB │ dev2rt987 │ disabled │

0|app | server is listening on port 4000

but when I open server from browser. Request dont come to the server. I checked 4000 port its open and listening on the server.

I compiled my app.js using npm build then pm2 start public/app.js worked for me

Have another answer? Share your knowledge.