Error: listen EADDRINUSE: address already in use :::3000

Filed under Deployment failures

Most likely causeAbout 10 min · 6 steps

Another program — almost always your own dev server from an earlier terminal — is already using port 3000, so the new one cannot start.

Find the process on the port
Stop your old dev server
Or start on port 3001

Fastest route

Give your AI this prompt

Copy it, replace the bracketed part with your error, and send it.

Preview the prompt
When I start my app I get this error and it will not run:

Error: listen EADDRINUSE: address already in use :::3000

My setup: [your operating system — Mac / Windows / Linux], and I start the app with [the command you run, e.g. npm run dev]. I am working in [name your tool — VS Code, Replit, Lovable, a terminal].

Please: 1) tell me the exact command to find which process is using port 3000 on my system, and how to read its output, 2) tell me how to stop that process safely, 3) if it turns out to be something I should not stop, tell me how to run this project on port 3001 instead, including any file you would change, 4) tell me how to check whether a Docker container is holding the port.

Constraints: do not suggest reinstalling Node or my dependencies, do not delete any project files, and explain each command in one plain sentence before I run it.

Fix it yourself

Follow the repair

  1. Find out what is holding the port. On Mac or Linux, run this in a terminal — it names the program and its process ID (PID), the number you need for the next step:
    lsof -i :3000
    On Windows, run this in Command Prompt, and note the number at the end of the matching line:
    netstat -ano | findstr :3000
    If the program is node, you have found your earlier server. If the terminal says nothing is using the port but the error persists, restart the terminal (or the computer) once — the port listing itself can be stale after a crash.
  2. Stop it. If it is your old dev server and you can see its terminal, click into that terminal and press Ctrl+C — the clean way. If the terminal is gone, end the process by its PID from step 1:
    # Mac / Linux (replace 12345 with your PID)
    kill -9 12345
    
    # One-command shortcut on Mac / Linux
    npx kill-port 3000
    :: Windows (replace 12345 with your PID)
    taskkill /PID 12345 /F
    Then start your app again the normal way; the port is free now.
  3. Or simply move to a different port. If the thing on 3000 is an app you actually want to keep running, do not kill it — park this project in the next space instead:
    npm run dev -- -p 3001
    Your app now lives at http://localhost:3001. Note the address in the terminal output; your browser favorites still point at the old port, which is a classic five minutes of confusion. In an AI builder, check the tool's port or preview settings for the equivalent option.
  4. Hunt down the usual hiding places. Still blocked? Check, in this order: every open terminal tab in your editor (VS Code's terminal panel collects them), the AI builder's preview or console pane, and any terminal windows minimized earlier. On Windows, Task Manager's Details tab sorted by name will show stray node.exe processes. Ending the one you recognize is safe; your work is in your files, not in the running server.
  5. If Docker is involved, check the containers. A container from an earlier session can hold the port even after you closed everything else:
    docker ps
    docker compose down
    Run docker ps to see what is running and which ports it has claimed; docker compose down, run in that project's folder, stops its containers and releases their ports.
  6. Make it stop happening. Two habits end this error for good. First, always stop your dev server with Ctrl+C before closing the terminal — a closed browser tab stops nothing. Second, if you regularly run two projects, give the second one its own permanent port in its package.json scripts, for example "dev": "next dev -p 3001", so the two never compete for the same space again.
Why this happensOptional explanation

A port is like a numbered parking space your app sits in so your browser can find it. Port 3000 is the default space for most JavaScript dev servers. When a program is already parked there, the operating system refuses to let a second program take the same space, and Node reports that refusal as EADDRINUSE — "error, address in use." The app that fails is the innocent one; the app already holding the port is the cause.

Nine times out of ten the squatter is you. A dev server does not stop when you close the browser tab, and it does not always stop when you close the editor — it stops when its terminal gets Ctrl+C or is closed. AI builders make this more likely, not less: one click starts a preview inside the tool, you open a terminal and start another copy yourself, and now two servers are fighting over one port. Less often, a crashed process leaves the port held, or a completely different program (another project, a database tool, Docker) got to 3000 first.

  • Your own earlier dev server: still running in a forgotten terminal, IDE tab, or the AI builder's preview pane.
  • A zombie process: the server crashed or the terminal closed badly, but the Node process survived and kept the port.
  • Two projects at once: another app you run also defaults to port 3000.
  • Something else entirely: Docker containers and other dev tools can hold the port across restarts.

Quick answers

Is something wrong with my code?

No. EADDRINUSE is about the port, not your code. It means another program got to port 3000 first. The overwhelming majority of the time it is your own app, still running in a terminal or preview pane you forgot about. Stop that copy, or start this one on a different port, and the 'error' is gone.

How do I stop the old server properly?

Press Ctrl+C in the terminal where it is running. Closing the browser tab does nothing — the server keeps running in the terminal — and closing the editor does not reliably stop it either. If the terminal is already gone, find the process with lsof -i :3000 (Mac/Linux) or netstat -ano | findstr :3000 (Windows) and end it by its PID.

Can I run two projects at the same time?

Yes. Keep each project on its own port: run npm run dev -- -p 3001, or set the port permanently in that project's package.json dev script. Just remember each project then lives at its own address — localhost:3000 for one, localhost:3001 for the other.

One fix, every Friday.

One real error, explained in plain English, with the fix — in your inbox every Friday. No spam, no jargon, unsubscribe anytime. Every issue closes with a verse and a word of encouragement.