node js listen EADDRINUSE error for simple httpserver

I have simple node js http server.

var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");

If I run

node basicserver.js 

I get

        throw e; // process.nextTick error, or 'error' event on first tick
Error: listen EADDRINUSE
    at errnoException (net.js:642:11)
    at Array.0 (net.js:743:26)
    at EventEmitter._tickCallback (node.js:192:40)

I have seen this post, but that post seems to be specific to TCP server and not http server. Could anyone please help.


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.


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.

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.

Same problem may occur when you try to run the server, but you don't have root privileges.

I also ran into this issue with EADDRINUSE After checking for Node processes I changed the server ip to 'localhost'. After doing this it started right up. Hope this helps.

On my Linux Mint only kill by PID work for me:

netstat -nltp | grep 8080 - shows PID of using 8080 port, my output:

tcp 0 0* LISTEN 27599/node - PID of node dev server is 27599 in my case

and then kill:

kill -9 <PID>

kill -9 27599


Don't know what a bug, but I am start my WebPack dev server like npm run dev:

webpack-dev-server --hot --host int.loc --port 8080

And when interrupt him - in terminal by Ctrl+C and start it again - he causing same error Error: listen EADDRINUSE, but all time before it work perfect.

killall node not helped.

For Windows users: in Powershell, you can use:

Stop-Process -Name "ProcessName" -Force

In this case "ProcessName" would be "node".

More info here: How to kill a process in windows

Need Your Help

RichTextBox (WPF) does not have string property "Text"

c# wpf wpf-controls richtextbox

I am trying to set/get the text of my RichTextBox, but Text is not among list of its properties when I want to get test.Text...

Centering text in a table in Twitter Bootstrap


For some reason, The text inside the table still is not centered. Why? How do I center the text inside the table?