http-party/node-portfinder

can't find correct port in window 10

houfeng0923 opened this issue · 2 comments

node : v8.9.4
window10

when start server(http or socket) without host binding , i find module can't detect the port is using .

## server
var http = require('http');
var server = http.createServer(function(req, resp) {
  resp.end('hello');
})
server.listen(8080); // no host 

## test 
var portfinder = require('portfinder');
portfinder.basePort = 8080;
portfinder.getPort(function (err, port) {
  console.log(port); // return 8080 in window10 
});

and it work well in macos and linux.

@houfeng0923 - thanks for the report - this seems to be coming up a bit more, perhaps now that windows 10 is in larger circulation.

If u pass a host, like ::1 or localhost does it go away?
Also, apparently (I was told) you can pass * as a host on windows. This is not accounted for currently in the codebase. There is a comment(in the issues here, i think, couldn't find it just now) that mentions this specifically. This may fix it.

2 ways to help push this forward:

  • log os.networkInterfaces() by any chance.
  • run the above code with DEBUG= 'portfinder:*' and catch the output into a gist, paste that link here

Thanks

closed by #67