
The application will not start and the message says Error: listen EADDRINUSE: address already in use :::3000. In Python, the version is OSError: [Errno 98] Address already in use. The short answer: another process is already listening on that port, and only one program can listen on a port at a time. Nearly always it is the same application, still running from an earlier attempt. This article is for a VPS; on shared hosting the case is different (see the end).
Finding who holds the port
|
|
|
|
The causes behind it
| Cause | How to recognise it | What to do |
| Two instances of the same application | ss shows your node; pm2 list has the application twice, or one runs by hand and another as a service. |
Keep one only: PM2 or systemd, not both, and not an open session at the same time. |
| A service restarting in a loop | The service status flips and the log repeats the error. | Stop the service, sort out the port, start again. See reading systemctl status. |
| A container publishes the same port | docker ps shows the published port. |
Change the left-hand port in -p: your first container. |
| Another legitimate program | ss shows a service you know. |
Pick another port for your application. Below 1024 only root can listen. |
| Development with auto-reload | An old process got stuck after an error. | End the old process, as in step 3. |
Do not blindly kill the process ss shows. Check what it is first: it may be nginx or the database, and stopping those takes other sites down. If in doubt, ask whoever set the server up. On an unmanaged VPS, managing processes is yours: how far our support goes.
|
On shared hosting (cPanel) you do not choose ports: Passenger connects the domain to the application. If you see this error there, the code is trying to open a second server, or a fixed port with an old server still alive. Use process.env.PORT || 3000 in listen and restart with the button on the application screen. For the rest, see ports and firewall on a VPS.
|
|
Done all this and the port is still taken? Send us the |
|
SEE ALSO Ports and firewall on a VPS: why your app is not reachable Keeping a Node.js app running on a VPS with PM2 A service will not start on my VPS: reading systemctl status |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon) See plans |
- 0 Users Found This Useful











