Open vaecebyZ opened 5 months ago
Hi @vaecebyZ thanks for the investigation. The undefined
host trial is to check the operating system's default host (which is not predictable easily).
If you try _tryPort(0, undefined)
on your machine would it return false?
Hi @vaecebyZ thanks for the investigation. The
undefined
host trial is to check the operating system's default host (which is not predictable easily).If you try
_tryPort(0, undefined)
on your machine would it return false?
I try _tryPort(0, undefined)
it not return false,but for of host
one of them returns false
now i find get false ip and port: find reason,my nic dhcp fail ,I disabled this nic now it works🤣🤣🤣🤣
Hmm interesting. I think we have to exclude 169.254.*
IP (it is invalid IP) from hosts reported by operating system (funny enough, windows returns them unchecked)
Environment
get-port-please:3.1.2 os: Windwos11 23H2 22631.3593 node: 20.12.2 pnpm: 9.1.1 vite: 5.2.7
Reproduction
just fixed. now it works.
Describe the bug
today i start my progarm. up faild by "Unable to find a random port on any host" , then I find function 'checkPort()' return false. in function the _getLocalHosts() get array host but host[0] = undefined, so _tryPort() will get one false , then the false value will be return and get checkPort() fail .
I commented out this line.now its work (temporarily)🤣🤣🤣
thanks.
Additional context
this is console value: ` if (!host) { host = _getLocalHosts([void 0, "0.0.0.0"]); console.log(host) } //[ undefined, '0.0.0.0', '192.168.0.5', '192.168.56.1', '192.168.150.2', '169.254.158.97', '192.168.79.1', '10.144.103.31', '192.168.60.1' ]
=====================
for (const _host of host) { const _port = await _tryPort(port, _host); console.log("_port",_port) .... }
//_port 3070 _port 3070 _port 3070 _port 3070 _port 3070 _port false `
Logs