diff --git a/bin/http-server b/bin/http-server index 7c597fa8..25f0da54 100755 --- a/bin/http-server +++ b/bin/http-server @@ -224,9 +224,12 @@ function listen(port) { if (argv.a && host !== '0.0.0.0') { logger.info(` ${protocol}${host}:${chalk.green(port.toString())}`); } else { + // In Node [18, 18.4), interface family is a number, whereas earlier versions provide a string + var nodeVer = process.versions.node.split('.'); + var ipv4Family = (nodeVer[0] === '18' && parseInt(nodeVer[1], 10) < 4) ? 4 : 'IPv4'; Object.keys(ifaces).forEach(function (dev) { ifaces[dev].forEach(function (details) { - if (details.family === 'IPv4') { + if (details.family === ipv4Family) { logger.info((' ' + protocol + details.address + ':' + chalk.green(port.toString()))); } });