fix: check node version and find acceptable host accordingly

This commit is contained in:
Ari Gibson 2022-06-15 00:20:01 -06:00
parent 31e3224319
commit 27e70a38e7
No known key found for this signature in database
GPG key ID: 26E88FB91AA5B8EC
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix: find a hosting network differently based on Node version

View file

@ -86,7 +86,9 @@ export function devStart({
const ipv4Networks = Object.values(os.networkInterfaces())
.flatMap((networkInterface) => networkInterface ?? [])
.filter(
(networkInterface) => networkInterface?.address && networkInterface?.family === 'IPv4'
(networkInterface) =>
networkInterface?.address &&
networkInterface?.family === (Number(process.version.substring(1, 5)) < 18.1 ? 'IPv4' : 4)
);
for (let { address } of ipv4Networks) {
if (address.includes('127.0.0.1')) {