Closed mzgoddard closed 9 years ago
This is a Node issue. This used to work and is a regression in Node.
@sindresorhus Its a regression in Node but its pretty intentional and gives a clearer error than the prior EADDRNOTAVAIL
. Even if its a regression in Node, it seems incorrect to me that the code even tries to check port 0 with portscanner. portscanner checks ports by attempting to connect to them and in Node's case it doesn't make sense to bind to port 0 thinking it'll actually be port 0 instead of resulting in a random port. portscanner will always say that port 0 is available.
This appears to me as a misuse of portscanner.
This happens even without portscanner
. portscanner
is for the https://github.com/gruntjs/grunt-contrib-connect#useavailableport option, setting port
to 0
is to get a random port. Different.
iojs and 0.12 error if Socket.connect receives port 0. https://github.com/joyent/node/blob/master/lib/net.js#L901
grunt-contrib-connect needs to make sure not to pass port 0. This might just need to be updating tests and documenting this but maybe some changes to the task too.