i am testing a server written in nodejs on windows 7 and when i try to run the tester in the command line i get the following error
Error: listen EADDRINUSE
I created 2 servers, listening on same port 8081, running from same code, while learning
1st server creation shud have worked 2nd server creation failed with EADDRINUSE
node.js callback delays might be reason behind neither worked, or 2nd server creation had exception, and program exited, so 1st server is also closed
2 server issue hint, I got from: How to fix Error: listen EADDRINUSE while using nodejs?
It may be possible that you have tried to run the npm start command in two different tabs .you cant run npm start when it is already running in some tab.check it once .
simply kill the node as pkill -9 node in terminal of ubantu than start node
I used the command netstat -ano | grep "portnumber"
in order to list out the port number/PID for that process.
Then, you can use taskkill -f //pid 111111
to kill the process, last value being the pid you find from the first command.
One problem I run into at times is node respawning even after killing the process, so I have to use the good old task manager to manually kill the node process.