diff --git a/.changeset/strange-needles-hide.md b/.changeset/strange-needles-hide.md new file mode 100644 index 0000000000..bcfab67013 --- /dev/null +++ b/.changeset/strange-needles-hide.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: find a hosting network differently based on Node version -- adjusted for Node v18.4+ diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index aa29723c63..7676a5b7ca 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -83,12 +83,13 @@ export function devStart({ if (networkLogging === 'host-to-expose') { network = `${networkPrefix}${dim('use --host to expose')}`; } else if (networkLogging === 'visible') { + const nodeVersion = Number(process.version.substring(1, process.version.indexOf(".", 5))); const ipv4Networks = Object.values(os.networkInterfaces()) .flatMap((networkInterface) => networkInterface ?? []) .filter( (networkInterface) => networkInterface?.address && - networkInterface?.family === (Number(process.version.substring(1, 5)) < 18.1 ? 'IPv4' : 4) + networkInterface?.family === ((nodeVersion < 18 || nodeVersion >= 18.4) ? 'IPv4' : 4) ); for (let { address } of ipv4Networks) { if (address.includes('127.0.0.1')) {