Fix Error: listen EADDRINUSE: address already in use :::3000 and Vite Port 5173 is in use
Error: listen EADDRINUSE: address already in use :::3000This Node.js error means another process is already listening on port 3000 (the ::: is the
IPv6 form of “all addresses”; you may also see 127.0.0.1:3000). Often it is a copy of the
same server you started earlier and never stopped.
Vite handles the same situation differently. By default it prints:
Port 5173 is in use, trying another one...and starts on the next free port, so the server is up but not where you expect. With
--strictPort (or server.strictPort: true) Vite exits instead, with
Error: Port 5173 is already in use.
Fix it yourself
Section titled “Fix it yourself”-
Find the process that owns the port and end it. On Windows:
Terminal window netstat -ano | findstr :3000taskkill /PID 12345 /FStep by step, with the PowerShell version, in Find and kill the process using a port.
-
Or start your server on another port, for example
PORT=3001for many Node servers or--port 5174for Vite.
How Moonpool helps
Section titled “How Moonpool helps”If you run the server through Moonpool, set port on its entry. Moonpool then:
- shows the app as Running while something answers on that port, so a leftover server holding it appears as running but not “managed by Moonpool”;
- on Stop and Restart, kills whatever still listens on
portwhenkillModeisport, which is the default forwebapps, so the next Launch finds the port free; - flags two apps that are configured with the same
port.
{ "id": "api", "name": "API", "group": "Web apps", "type": "web", "cwd": "C:\\code\\api", "command": "node server.js", "port": 3000, "env": { "PORT": "3000" }, "killMode": "port"}Moonpool does not check the port before it launches. If the port is still taken, the command prints the error above in the app’s terminal tab. Press Stop (which frees the port) and Launch again.
For Vite, pass --strictPort and keep port equal to the port you ask for:
npm run dev -- --port 5173 --strictPortWithout it, Vite may move to 5174 while Moonpool keeps watching 5173, and the status dot never turns solid.
killMode port kills any process on the port, so use it only for ports nothing else needs.
For Docker apps on Windows, never use it. See
Stop and restart.
See also
Section titled “See also”Moonpool is free software from FasterDB