Fix “port already in use” (EADDRINUSE)

Your dev server won’t start because something is already on port 3000? Find it and stop it in under a minute.

1 min4 stepsmacOS · Linux · Windows

  1. Find what is using the port

    Replace 3000 with the port from your error message. The PID column is the process ID.

    lsof -i :
    COMMAND   PID USER   FD   TYPE  NODE NAME
    node    48213 you    23u  IPv6  TCP *:3000 (LISTEN)
  2. Stop it gracefully

    Use the PID from step 1. Most programs exit cleanly.

    kill
  3. Still stuck? Force it

    This one-liner finds and force-kills everything on the port.

    kill -9 $(lsof -ti :)

    Force-kills without letting the program save. Check with lsof -i first.

  4. On Windows

    Run this in PowerShell instead.

    Stop-Process -Id (Get-NetTCPConnection -LocalPort ).OwningProcess -Force

More guides