I have started a Node server through the plugin of an IDE. Unfortunately, I cannot use the IDE's terminal. So I tried to run the script from the command line.
This is the problem - I am using the Express module and my app is listening some port (8080). When I start the app from the command line, it throws this error:
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at Object.<anonymous> (C:\xampp\htdocs\node\chat\app.js:5: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)
at Module.runMain (module.js:492:10)
Even though I am not very sure what this error could be I assumed that it's because the app is listening on a port which is already in use. So I did:
netstat -an
I can see
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING
It's because the Node server is already started when I tried to start it from the IDE.
So I want to know, how can I stop all server instances? Also if you can tell me how to detect what's running on a port and kill it.