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

Windows 11
Wappler 7.0.1
Windows own server (node)
Database: Docker local cloud

Not new, been happening a while but seeing this error on a regtular basis.
Thought this was a Windows issue not releasing ports after use when project switching but today it happened immediatley after morning boot.

Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1939:16)
at listenInCluster (node:net:1996:12)
at Server.listen (node:net:2101:7)
at Object.start (E:\webs\ebook\lib\server.js:116:16)
at Object. (E:\webs\ebook\index.js:3:8)
at Module._compile (node:internal/modules/cjs/loader:1738:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1904:10)
at Module.load (node:internal/modules/cjs/loader:1472:32)
at Module._load (node:internal/modules/cjs/loader:1289:12)
at c._load (node:electron/js2c/node_init:2:17950) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3000
}

In past, have been rebooting to fix this (closing wappler is not enough) but
I have found I can fix by opening terminal and finding the PID of the port

netstat -ano | findstr :3000

gives the PID:

  TCP    0.0.0.0:3000   0.0.0.0:0   LISTENING   5764
  TCP    [::]:3000   [::]:0   LISTENING   5764

and i can then close the port with (where 5764 is the retruned PID)

taskkill /pid 5764 /F

You will see:

SUCCESS: The process with PID 5764 has been terminated.

where upon the server can be restarted.

Managed to grab a debug log this time.
I see nothing obvious in it but I'm not the log expert

wappler.zip (6.8 KB)

I get this now and then and use:

kill $(lsof -t -i:3000)

Mac user?
Windows doesnt seem to recognise "lsofg"

1 Like

Log added

Most likely your Dockercompose file is messed up. Just go to Project Settings and Click Save.
After - Click Deploy.

Not using docker

Which is it?

It means he's using NodeJS outside Docker, and a database inside Docker

@Hyperbytes consider using Process Hacker, an advanced task manager, to potentially investigate the issue further. You can view the working directory of a process, what parameters it was started, etc.

Well, it is Docker that is causing the problem. Never had a EADDRINUSE error until I started using Docker about a month ago. It is caused when it is trying to run two processes (probably from two different containers) using the same port.

I assumed that the database container would be running on a different port to the web server but i guess that may not be the case?

Time to completely dump docker out of my life and start running a dedicated local mysql server on my network i think.

Ben's theory is valid, but I disagree it's Docker's fault. Docker is just a victim, the real culprit is Wappler not properly handling project switches/starts

In case of Hyperbytes, I suspect it's a similar situation, but not the same exact situation as Ben's - Wappler's project switching might be flawed, and that would affect both Docker (Ben) and standalone NodeJS (Hyperbytes) situations

I initially built my application without Docker and started with MySQL. Later on, based on recommendations from various LLMs, I switched to Docker and Postgres.

It’s been a bit rocky—Docker has given me plenty of headaches, and I’m still in the middle of transitioning to Postgres.

Brian, I’ve decided to set Claude’s advice aside and follow yours. Fingers crossed this resolves the issues.

Edit: I found the suggestion from Copilot

From a technical standpoint, this level of modularity, multi-tenancy, and compliance tracking practically begs for Docker. While the initial friction might feel tedious, containerization will reward you with:

  • :wrench: Repeatable deployments: Ideal for testing new features without risking production
  • :brick: Tenant isolation: You could even consider per-tenant containers or scoped services down the line
  • :package: Stack consistency: Especially important with PKI certs and secure real-time sockets
  • :chart_with_upwards_trend: Scalability: As adoption grows, orchestrating with Docker Compose or transitioning to Kubernetes becomes more feasible

The shift to Postgres also aligns beautifully, particularly for the kind of granular multi-tenant data segregation and row-level security you're aiming for. It’ll be worth the conversion effort, even if Knex.js needs some care in migration handling.

Maybe bite the bullet and continue???

I have MariaDB and PostgeSQL installed on network now.

My VPS currently uses MySQL.

I asked coPilot about adding PostgreSQL and it is easy.

At the end of the output it did say

:brain: Pro Tip for You, Brian

Since you're meticulous about modularity and reliability, you might consider wrapping this setup in a reusable script that checks for existing installations, backs up configs, and logs each step. Want help drafting that?

Or would you like to explore integrating PostgreSQL into your existing JSON or Markdown workflows

I think coPilot just payed me a compliment!

I just need a reliable local db server as an alternative to Sqlite which doesnt screw up every 30 minutes

I have just found out the hard way, to always use Wappler's Database Manager to create migrations. Had I done this from the start, my 40 odd tables, a dozen views and numerous seeds for the Postgres database would have been a sinch. Never too old to learn.

Rebuilding (GPT4.1 so as not to use the premium stuff in Claude) the migrations now.

First time i have seen this which happened when leaving computer open for about 2 hrs inactive

i issued: netstat -ano | findstr :3000

image

Maybe a clue as to the port not closing?

Just in case it helps anyone diagnose the issue

(local DB servers in place but not yet migrated data so still locked into docker temporarily)

I think that's not an important detail, the important is there's a NodeJS process that isn't terminated

it seems like when switching projects using the build-in server in Wappler on Windows, the new server instance is being started while the previous one is being killed (which can take some time on windows)

Usually just preforming stop and start of the local web server from the bottom toolbar should work fine.

I will investigate if we can synchronize things better.

No, a stop and start does not work, i either have to kill the process manually or reboot my computer

And it is not only on project switch, it can occur immediatley after boot but more commonly when i leave my computer open but unattended for a period (high minutes seems enough, not just hours)
Happened twice in last few days immediatley on opening Wappler