0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

fix: check node version and find acceptable host accordingly (#3599)

This commit is contained in:
Ari Gibson 2022-06-15 09:26:55 -06:00 committed by GitHub
parent f1f207839a
commit 0ffc350c8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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()) const ipv4Networks = Object.values(os.networkInterfaces())
.flatMap((networkInterface) => networkInterface ?? []) .flatMap((networkInterface) => networkInterface ?? [])
.filter( .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) { for (let { address } of ipv4Networks) {
if (address.includes('127.0.0.1')) { if (address.includes('127.0.0.1')) {