extended-salmon
extended-salmonā€¢6mo ago

How to start servers for two Refine projects

I have two refine React projects and I'm trying to run both local servers concurrently. But after running the first one then I try to run the second one, I get this error even after changing the port in the package.json scripts:
$ refine dev --port 5173

āœ“ refine devtools is running at port 5001

node:events:492
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::5002
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
...
...
Emitted 'error' event on WebSocketServer instance at:
... {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 5002
}

Node.js v20.9.0
error Command failed with exit code 1.
$ refine dev --port 5173

āœ“ refine devtools is running at port 5001

node:events:492
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::5002
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
...
...
Emitted 'error' event on WebSocketServer instance at:
... {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 5002
}

Node.js v20.9.0
error Command failed with exit code 1.
The first server runs on port 5177 while I set the second to 5173 I'm using Yarn.
4 Replies
kapa.ai
kapa.aiā€¢6mo ago
Hi @script4559. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the extracts, it seems like you're encountering a known issue where trying to run two refine projects simultaneously results in a port conflict error. This issue has been reported on the refine GitHub repository (https://github.com/refinedev/refine/issues/5294). The error message Error: listen EADDRINUSE: address already in use :::5002 indicates that the port 5002 is already in use by another process, which in this case is likely the first refine project you started. Currently, refine does not automatically generate a new port if the default one is in use, unlike some other frameworks like Next.js. The user who reported this issue suggested that refine should catch this specific error and trigger the generation of a new port. As a workaround, you might want to try manually specifying a different port for the second project. However, it seems like you've already tried this and it didn't work. It's possible that refine is not correctly recognizing the port specified in the package.json scripts. Unfortunately, the extracts do not provide a solution to this issue. You might want to follow the GitHub issue for updates or reach out to the refine community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.aiā€¢6mo ago
<@584066183989428345> kapa.ai is still learning and improving, please let us know how it did by reacting below
passive-yellow
passive-yellowā€¢6mo ago
Hey @script4559, sorry for the issue! With the latest release, we've updated @refinedev/cli to accept --devtools option, which can be set to --devtools=false and prevent devtools servers from starting. Can you try to update your refine dependencies to @latest and use refine dev --devtools=false to start your project? Let me know if you have any further issues šŸ™
extended-salmon
extended-salmonā€¢6mo ago
No issues it works fine now Thanks G