fix: detect cross-address-family port conflicts in next dev
On some platforms (notably macOS), server.listen() with no hostname
binds to IPv6 (::) which does not trigger EADDRINUSE when another
server is already listening on IPv4 (e.g., 127.0.0.1 or 0.0.0.0) on
the same port. This causes two dev servers to appear to share port 3000.
Add a proactive port availability check that tests both IPv4 (0.0.0.0)
and IPv6 (::) before calling server.listen(). When a conflict is
detected and allowRetry is enabled (default port), the server
automatically finds the next available port and shows a warning.
The existing EADDRINUSE error handler in server.on('error') is retained
as a fallback for same-address-family conflicts.
Showing
Please
register
or
sign in
to comment