2

I have installed PM2 to keep my node application running. (https://github.com/Unitech/pm2)

It works great, however...

Since installing and running my app with it

pm2 start app.js pm2 stop app

I am no longer able to run my app using

node app.js

Instead I get the following error:

domain.js:66
    throw er;
          ^
Error: listen EADDRINUSE
    at errnoException (net.js:770:11)
    at Server._listen2 (net.js:910:14)
    at listen (net.js:932:10)
    at Server.listen (net.js:998:5)
    at Function.app.listen (/home/ssp/node_modules/express/lib/application.js:535:24)
    at Object.<anonymous> (/home/ssp/app.dev.js:22:5)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

This error usually happens when you try to run the same thing twice.

However app.js is not running. I have stopped it in PM2. And when I type

ps aux | grep node

To check if it is still there, it is not.

Uninstalling PM2 does not seem to fix this. Any ideas what is going on?

3
  • What does pm2 list say? is it still keeping the port open "for convenience"? Commented Sep 20, 2013 at 0:27
  • Since pm2 overwrites the process title, your app won't show up using the ps command you mention; either grep for app (instead of node) or use pm2 list instead, as Mike suggests. Commented Sep 20, 2013 at 6:53
  • Ah, known issue Commented Sep 20, 2013 at 7:02

2 Answers 2

6

Overall this means that you have a process running on the same port, you can kill it using:

sudo kill $(sudo lsof -t -i:8080)

just replace 8080 with your server port

Sign up to request clarification or add additional context in comments.

Comments

3

If you get this problem do a :

pm2 kill

(it kills pm2 and the port is freed)

This bug is really strange and impact only v0.10.x node versions.

I recommend you to use the node v0.11.10

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.