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
{{ message }}
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
Hello! I want to implement that a different port is tried automatically when the currently tried out port is in use. However, it is impossible to catch the EADDRINUSE exception when running await node.start();. NodeJS terminates before node.start() returns a Promise.
Following is output:
node:events:491
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::8000
at Server.setupListenHandle [as _listen2] (node:net:1485:16)
at listenInCluster (node:net:1533:12)
at Server.listen (node:net:1621:7)
at file:///project/node_modules/it-ws/dist/src/server.js:14:25
at new Promise (<anonymous>)
at Server.listen (file:///project/node_modules/it-ws/dist/src/server.js:12:22)
at WebSocketListener.listen (file:///project/node_modules/@libp2p/websockets/dist/src/listener.js:72:27)
at DefaultTransportManager.listen (file:///project/node_modules/libp2p/dist/src/transport-manager.js:155:37)
at DefaultTransportManager.start (file:///project/node_modules/libp2p/dist/src/transport-manager.js:44:20)
at file:///project/node_modules/@libp2p/components/dist/src/index.js:67:29
Emitted 'error' event on WebSocketServer instance at:
at Server.emit (node:events:513:28)
at emitErrorNT (node:net:1512:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 8000
}
Node.js v18.9.0
To me, the issue has a medium severity, because the workaround to check the port usage before is tedious, platform dependent, and cannot be reliable because it is not atomic.
Hello! I want to implement that a different port is tried automatically when the currently tried out port is in use. However, it is impossible to catch the EADDRINUSE exception when running
await node.start();. NodeJS terminates beforenode.start()returns a Promise.Following is output:
To me, the issue has a medium severity, because the workaround to check the port usage before is tedious, platform dependent, and cannot be reliable because it is not atomic.
Versions:
Possibly related: