Fix guides · Cursor, Claude Code, Windsurf ·

Fix EADDRINUSE: address already in use :::3000

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

This error means your app tried to start a server on port 3000, but something else is already listening there, usually an old copy of your own dev server still running in another terminal or in the background. The fix is to find the process holding port 3000 and stop it, or start your app on a different port. The `:::3000` part means "all network addresses, port 3000" (`::` is the IPv6 way of saying "every address").

Free · 3 a day · no signup

Common causes – and how to tell which one you have

1. An old dev server is still running

How to tell: You have another terminal tab, split pane, or agent-run terminal where `npm run dev` (or similar) is still active. Opening http://localhost:3000 in a browser shows your app even though the new start just failed.

Fix: Go to that terminal and press Ctrl+C to stop it, then start the server again. In Cursor, Claude Code, or Windsurf, check every open terminal, including ones the agent opened for itself.

2. An orphaned or suspended process

How to tell: No visible terminal is running the server, but the port is still taken. This happens after a crash, after closing the editor, or after pressing Ctrl+Z, which pauses a process instead of stopping it.

Fix: Find the process ID (PID, the number the OS uses to identify a running program): on macOS/Linux run `lsof -i :3000`, on Windows run `netstat -ano | findstr :3000`. Then stop it with `kill <PID>` (macOS/Linux) or `taskkill /PID <PID> /F` (Windows).

3. A different app uses port 3000

How to tell: The lookup command shows a process that isn't your project, for example another project's dev server, a Docker container, or a tool like Grafana that defaults to 3000.

Fix: If you need that other app, run yours on another port instead, e.g. `PORT=3001 npm run dev` on macOS/Linux, or `next dev -p 3001` for Next.js. Your app must read `process.env.PORT` for the PORT variable to have any effect.

4. Your code calls listen() twice

How to tell: The error appears even right after you've confirmed nothing is on port 3000, and the logs show your server starting once before it crashes. Typical culprits are two files that both call `app.listen(3000)`, or a test file importing the server module that calls listen.

Fix: Make sure `listen()` is called in exactly one place, usually a small entry file like `server.js`. Export the app without starting it so tests and other files can import it safely.

5. A watcher restarts before the old server exits

How to tell: You use nodemon, tsx watch, or similar, and the error shows up right after saving a file, sometimes only now and then.

Fix: Make sure the old process fully exits on restart: avoid running two watchers at once, and handle shutdown signals so the server closes cleanly. Restarting the watcher from scratch usually clears it.

How to fix it

  1. Look through every open terminal, including ones your AI agent opened, and press Ctrl+C in any that is running your dev server.
  2. If the error persists, find what holds the port. On macOS/Linux run `lsof -i :3000`; on Windows run `netstat -ano | findstr :3000`. Note the PID.
  3. Check what that process is. On macOS/Linux, the COMMAND column in the `lsof` output shows its name. On Windows, run `tasklist /FI "PID eq <PID>"`. Only continue if it's a stale dev server you don't need.
  4. Stop it: `kill <PID>` on macOS/Linux, or `taskkill /PID <PID> /F` on Windows. Use `kill -9 <PID>` only if the normal kill doesn't work.
  5. Run the lookup command again to confirm port 3000 is free, then start your dev server once.
  6. If the port belongs to something you need, start your app on another port (e.g. `PORT=3001 npm run dev`, or `next dev -p 3001`) and make sure your server code reads `process.env.PORT`.

Using Lovable, Bolt or v0?

Lovable, Bolt, and v0 run your app in their own environment, so you rarely see this error there. If you do, ask the tool to "stop any running dev server and restart it once" rather than starting a new one. If you deploy a Node server to a host like Render, Railway, or Replit, tell the tool to make the server listen on `process.env.PORT` instead of a hard-coded 3000, because those hosts choose the port for you.

Using Cursor, Claude Code or Windsurf?

Ask the agent to identify what is on port 3000 before killing anything, and to check whether it started a background dev server itself earlier in the session. Agents often launch `npm run dev` in a background terminal, then launch it again later. Have it verify the fix by re-running the port lookup (it should show only one server process) and by loading http://localhost:3000. If the error comes back without any outside process on the port, ask it to search the code for duplicate `listen(` calls.

The “fix” to avoid

Agents often add `killall node`, `pkill node`, or `kill -9 $(lsof -ti :3000)` to a startup script, or keep bumping the port to 3001, 3002, and so on. Blanket killing Node can stop unrelated tools and other projects, and `kill -9` skips cleanup. Bumping the port leaves stale servers piling up and can hide a real bug where your code calls listen() twice. Find out what owns the port, stop that one process, and keep a single fixed port your app reads from `PORT`.

Copy-paste fix prompt for your AI coding tool

Paste this into Cursor, Claude Code, Lovable or Bolt:

My dev server fails with: "Error: listen EADDRINUSE: address already in use :::3000". Please investigate in this order: 1) Check whether you or I already started a dev server in another terminal or background process during this session. 2) Find what process owns port 3000 (`lsof -i :3000` on macOS/Linux, `netstat -ano | findstr :3000` on Windows), and tell me its name and PID before stopping anything. 3) If it's a stale dev server from this project, stop only that PID. Don't use killall/pkill node. 4) If nothing external holds the port, search the code for duplicate `listen(` calls and make sure only one entry file starts the server. 5) Make the port read from `process.env.PORT` with 3000 as the default. Verify by re-running the port check, starting the server once, and confirming http://localhost:3000 responds.
Your error looks a bit different? Paste your exact error and get a diagnosis tailored to your code — free.

Questions people ask

How do I kill the process on port 3000?

On macOS/Linux, run `lsof -i :3000` to get the PID, then `kill <PID>`. On Windows, run `netstat -ano | findstr :3000`, then `taskkill /PID <PID> /F`. The `npx kill-port 3000` package also works, but check what the process is first.

What does ':::3000' mean in the error?

`::` is the IPv6 notation for "all addresses", so `:::3000` means your server tried to listen on port 3000 on every network interface. It is not a typo or a bad config. It just tells you which port is in use.

Why does this keep happening every time I restart?

Usually the old server isn't actually stopping, because the terminal was closed without Ctrl+C, Ctrl+Z only paused it, or a file watcher started a new copy before the old one exited. If it happens even with nothing else on the port, your code is probably calling listen() twice.

Official documentation

Related errors

Get fixes like this every week