← All errors · Replit

Error: listen EADDRINUSE: address already in use

Exact error

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

What it means

Another process is already listening on the port your server is trying to use.

Likely causes

How to fix it

  1. Stop the previous process (in Replit, stop and re-run; locally find it):

    lsof -i :3000
    kill <PID>
  2. Read the port from the environment with a fallback, and bind to 0.0.0.0 so hosted environments can reach it:

    const port = process.env.PORT || 3000;
    app.listen(port, '0.0.0.0', () => console.log('listening on', port));

Related errors

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy