PM2 (Node.js) not listening on specified port

Your app.set('port'... calls are not directly relevant. app.set is just a place to store key/value settings but it provides zero functionality in and of itself. What you want to look at is where you call app.listen since that function is what accepts a port as an argument.


I had a similar problem, with nginx configured as proxy server I couldn't see the Express app running by PM2. When I removed my ~/.pm2 folder it worked.


The answer to this, for anyone using Express, is to run this command:

pm2 start ./bin/www

I had been running pm2 start app.js which did not work.