I have installed PM2 to keep my node application running. ()
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._pile (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?
I have installed PM2 to keep my node application running. (https://github./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._pile (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?
Share Improve this question asked Sep 20, 2013 at 0:22 user1031947user1031947 6,68417 gold badges65 silver badges91 bronze badges 3-
What does
pm2 list
say? is it still keeping the port open "for convenience"? – Mike 'Pomax' Kamermans Commented Sep 20, 2013 at 0:27 -
Since pm2 overwrites the process title, your app won't show up using the
ps
mand you mention; either grep forapp
(instead ofnode
) or usepm2 list
instead, as Mike suggests. – robertklep Commented Sep 20, 2013 at 6:53 - Ah, known issue – robertklep Commented Sep 20, 2013 at 7:02
2 Answers
Reset to default 6Overall 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
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 remend you to use the node v0.11.10