Reputation: 6674
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?
Upvotes: 2
Views: 2893
Reputation: 9848
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
Upvotes: 6
Reputation: 5991
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
Upvotes: 3