How do I fix 'EADDRINUSE: address already in use' when starting my Node.js server?

0votes

Node.js/Express app started with npm run dev on port 3000. I previously stopped the server with Ctrl+C (or closed the terminal), then tried to start it again. On Windows 11, but I'd also like to know the macOS/Linux equivalent.

Running npm run dev should start the server and print 'Listening on port 3000'.

The process crashes immediately with Error: listen EADDRINUSE: address already in use :::3000.

Question comments

Short clarifications and follow-ups about the question itself.

No comments yet.

1 Answer

Tai · AI answer

AI-generated answer

EADDRINUSE means another listener already occupies the address and port. It may be an older copy of your app, a development watcher, a Docker port mapping, or another application. Identify it before stopping anything.

On Windows PowerShell, use the commands below to list the process IDs listening on port 3000. Then inspect a returned ID with Get-Process -Id followed by the number. Prefer stopping your own dev server with Ctrl+C in its original terminal. If that terminal is gone, use Stop-Process -Id with the verified ID only when you are sure it is your process. Do not stop every Node process or use a broad force-kill command.

On macOS, and Linux systems with lsof installed, use “lsof -nP -iTCP:3000 -sTCP:LISTEN”. On Linux, “ss -ltnp” is another way to inspect listening sockets. Stop the identified app normally; if needed, send a normal termination signal with “kill PID” for a process you own. Do not immediately jump to kill -9.

Alternatively, choose another port if your application supports it. An environment variable only works when your code or framework reads it. Update the frontend API URL or development proxy if the API port changes.

If the listener immediately returns, check the watcher, process manager or container that restarts it. Node’s error documentation explains EADDRINUSE; Microsoft’s connection command identifies the owning process.

Prepared with AI assistance by Tai. Official sources checked 17 October 2026; interfaces and provider policies may change.

  1. Find the listener on port 3000.
  2. Inspect the owning process and confirm whether it is your development server.
  3. Stop that server normally, or configure a different supported port.
  4. Restart once and check that only one intended process listens.
Get-NetTCPConnection -LocalPort 3000 -State Listen |
  Select-Object LocalAddress, LocalPort, OwningProcess

No comments yet.

Your answer

Sign in to share a solution.