-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: Error when using npm:portfinder
#18301
Comments
I tried debugging this. This package first checks port availability in order for all hostnames returned by So the minimal code that demonstrates the difference in behavior between Node.js and Deno looks like this: // import net from "https://deno.land/std@0.168.0/node/net.ts";
import net from "node:net";
const host1 = "0.0.0.0";
const host2 = null;
const server = net.createServer(() => {});
server.once("listening", () => {
// Listen on another host as soon as close the server.
server.close();
server.listen(8081, host2); // EADDRINUSE error occurs only in Deno!
});
server.listen(8081, host1); |
npm:portfinder
Update: |
Now the error message is like the below:
|
Just to mention this is probably the reason why |
Will fix as part of denoland/deno_core#440 |
I'm having trouble running portfinder, a package that finds available ports, on Deno.
Running the code below in Node.js correctly finds available ports.
However, when I run it on Deno, I get the following error:
> deno run -A ./tmp.mjs error: Uncaught Error: No open ports available at Server.onError (file:///C:/Users/ayame/AppData/Local/deno/npm/registry.npmjs.org/portfinder/1.0.32/lib/portfinder.js:58:23) at Object.onceWrapper (https://deno.land/std@0.168.0/node/_events.mjs:504:26) at Server.emit (https://deno.land/std@0.168.0/node/_events.mjs:379:28) at _emitErrorNT (https://deno.land/std@0.168.0/node/net.ts:1806:10) at processTicksAndRejections (https://deno.land/std@0.168.0/node/_next_tick.ts:41:15)
This problem should affect many packages that depend on portfinder.
The text was updated successfully, but these errors were encountered: