You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if you simply do email dev (without passing a port explicitly), it crashes with an ugly stack trace:
- error Failed to start server
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1817:16)
at listenInCluster (node:net:1865:12)
at Server.listen (node:net:1953:7)
...rest of the frames skipped
While you can pass -p <port> to use a different port, I think it would greatly improve DX if react-email automatically found the next available port when 3000 is already taken (as is the case if you’re using Next.js as-is AKA without passing PORT to it)
Proposal
Many dev commands already support this, and I’m sure there’s many ways to do this, but off the top of my head:
Use get-port, and pass it a list of default ports to use, and if all of them happen to be taken, assign a random port.
Again, I’m sure this can be achieved in many ways, so if my proposed solution does not fit well with you guys, feel free to suggest an alternative.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Goals
Background
Currently, if you simply do
email dev
(without passing a port explicitly), it crashes with an ugly stack trace:- error Failed to start server Error: listen EADDRINUSE: address already in use :::3000 at Server.setupListenHandle [as _listen2] (node:net:1817:16) at listenInCluster (node:net:1865:12) at Server.listen (node:net:1953:7) ...rest of the frames skipped
While you can pass
-p <port>
to use a different port, I think it would greatly improve DX ifreact-email
automatically found the next available port when3000
is already taken (as is the case if you’re using Next.js as-is AKA without passingPORT
to it)Proposal
Many
dev
commands already support this, and I’m sure there’s many ways to do this, but off the top of my head:Use
get-port
, and pass it a list of default ports to use, and if all of them happen to be taken, assign a random port.Again, I’m sure this can be achieved in many ways, so if my proposed solution does not fit well with you guys, feel free to suggest an alternative.
Sure, I can try.
Beta Was this translation helpful? Give feedback.
All reactions