Skip to content

/errors/express/eaddrinuse-address-already-in-use

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

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated 2026-10-20
tool
Express
exit code
1
versions
Node.js 18+, Express 4, Express 5
os
linux, macos, windows

Error: listen EADDRINUSE: address already in use :::3000 means your server tried to listen on a port that another socket already holds; ::: is the IPv6 "all addresses" form. Only one process can listen on a port at a time. Stop the other process, or use a different port.

Reproduce the error

Two Express apps on the same port in one process:

bash
npm init -y >/dev/null
npm install --silent --no-audit --no-fund express@5 >/dev/null 2>&1
node -e '
const express = require("express");
const first = express().listen(3456, () => {
  const second = express().listen(3456);
  second.on("error", (err) => { console.log(err.code, "-", err.message); first.close(); });
});'

Output

EADDRINUSE - listen EADDRINUSE: address already in use :::3456

Find the process that holds the port

bash
# Linux / macOS
lsof -i :3000
ss -ltnp 'sport = :3000'       # Linux

# Windows (PowerShell)
Get-NetTCPConnection -LocalPort 3000 | Select-Object OwningProcess

Then stop that process (kill <pid>, or Stop-Process -Id <pid> on Windows).

Use a configurable port

js
const port = Number(process.env.PORT ?? 3000);
const server = app.listen(port, () => console.log(`listening on ${port}`));
server.on('error', (err) => {
  if (err.code === 'EADDRINUSE') console.error(`port ${port} is busy, set PORT to another value`);
  else throw err;
});

PORT=3001 node app.js then starts a second copy without a conflict. Passing 0 lets the operating system pick any free port, which is handy in tests.

Sources