node js listen EADDRINUSE error for simple httpserver

To kill all the experiments on my machine...

 killall node

The port you are listening to is already being listened by another process.

When I faced to this error I killed the process using Windows PowerShell (because I used Windows)

  1. open the windows powershell
  2. type ps and then you can get list of processes
  3. find the process named node, and note the Id
  4. type Stop-process <Id>

I think that it is help for windows users.


The port you are listening to is already being listened by another process. In this case I got a feeling that it is your self. You can do a ps aux | grep node and then using kill <pid> kill your node process. Beside that you can also try another port.

--Update--

In case if you want to find which process is listening, you can use netstat -lpn ( -l is to find out the listening ports, -p is to include the process name and pid, -n is to not to resolve host names, or else it will be slow), to find the processes that are listening on different ports. If there was too many, you can do netstat -lnp | grep :8888.

Also can use, fuser 8888/tcp, which will show you the process pid and also adding -k will kill the process, fastest way ever.

I realized this two commands only work in linux.