How to fix npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address already in use in npm

npmBEGINNERMEDIUMUpdated Dec 5, 2025ยท 131 views

The EADDRINUSE error occurs when you try to start a Node.js server on a port that is already in use by another process. This typically happens when a previous server instance wasn't properly closed or another application is using the same port.

Quick fix

Fixes npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address already in use

npx kill-port 3000
  1. Kill the process using the specific port (recommended)
  2. Manually find and kill the process on Linux/macOS
  3. Kill the process on Windows
  4. Verify proper shutdown and restart your server
npm โ€” error
npx kill-port 3000
npm ERR! code EADDRINUSE
npm ERR! errno EADDRINUSE
npm ERR! Address already in use
shell
npx kill-port 3000

What this error means

EADDRINUSE is a system-level error (Address already in use) that Node.js raises when attempting to bind to a specific port. This means the operating system has already assigned that port to another process. The error prevents your Node.js application from listening for connections because the port is occupied. Common scenarios include a crashed server process still holding the port, another application already using it, or pressing Ctrl+Z instead of Ctrl+C which leaves the process running in the background.

Typical symptoms

  • npm start or npm run dev fails with 'listen EADDRINUSE' error message
  • Server cannot start even after stopping the application
  • Port number specified in error message (e.g., :::3000, :::5000, :::8080)
  • Previous server restart did not fully terminate the process
  • Port 5000 conflicts on macOS Monterey and later (AirPlay uses this port)

Common causes

  1. A previous Node.js server process is still running in the background after a crash or improper shutdown
  2. Using Ctrl+Z to stop the server instead of Ctrl+C, which suspends rather than terminates the process
  3. Another application or service is already using the same port (e.g., AirPlay on macOS using ports 5000-5001)
  4. Running app.listen() multiple times in your code on the same port
  5. Restarting the server too quickly before the OS fully releases the port

How to fix "npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address already in use"

1Kill the process using the specific port (recommended)

Use the kill-port npm package, which works on all platforms:

bash
npx kill-port 3000

Replace 3000 with your actual port number. You can also kill multiple ports at once:

bash
npx kill-port 3000 5000 8080

This is the easiest and most reliable method.

2Manually find and kill the process on Linux/macOS

If you prefer not to use a third-party package, find the process ID (PID) first:

bash
lsof -i :3000

This will show you which process is using port 3000. Look for the PID column, then terminate the process:

bash
kill -9 <PID>

Alternatively, use fuser for a one-command solution:

bash
sudo fuser -k 3000/tcp
3Kill the process on Windows

Open Command Prompt as Administrator and run:

bash
netstat -ano | findstr :3000

This shows the process using port 3000. Note the PID in the rightmost column, then kill it:

bash
taskkill /PID <PID> /F

Alternatively, kill all Node processes:

bash
taskkill /F /IM node.exe

Note: This will kill ALL Node processes, not just the one using the port.

4Verify proper shutdown and restart your server

Always use Ctrl+C to stop Node servers, never use Ctrl+Z. Ctrl+Z suspends the process in the background without actually terminating it.

After killing the process, verify the port is now free:

bash
lsof -i :3000

If nothing is returned, the port is free. Now restart your server:

bash
npm start
5Use a different port or configure dynamic port assignment

If the above steps don't work or the port is being used by another service, configure your app to use a different port:

javascript
const port = process.env.PORT || 3001;
app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});

Then start with:

bash
PORT=3001 npm start

Advanced notes

On macOS Monterey (version 12) and later, AirPlay automatically uses ports 5000 and 7000. If your development server uses port 5000, disable AirPlay Receiver in System Preferences > Sharing to free up the port. Older versions of nodemon (before 2.0.14) had issues with EADDRINUSE errors; update nodemon if you experience persistent issues.

Frequently asked questions

What does "npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address al" mean?
js raises when attempting to bind to a specific port. This means the operating system has already assigned that port to another process. js application from listening for connections because the port is occupied.
How do I fix "npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address al"?
The EADDRINUSE error occurs when you try to start a Node.js server on a port that is already in use by another process. This typically happens when a previous server instance wasn't properly closed or another application is using the same port.
What causes "npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address al"?
A previous Node.js server process is still running in the background after a crash or improper shutdown Using Ctrl+Z to stop the server instead of Ctrl+C, which suspends rather than terminates the process Another application or service is already using the same port (e.g., AirPlay on macOS using ports 5000-5001)
Is the "npm ERR! code EADDRINUSE npm ERR! errno EADDRINUSE npm ERR! Address al" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading