svelte 執行報錯 getaddrinfo ENOTFOUND localhost

1711293058發表於2020-06-12

svelte 執行報錯 getaddrinfo ENOTFOUND localhost

安裝svelte 之後,npm run dev

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND localhost
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
Emitted 'error' event on Server instance at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1495:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:17) {
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'localhost'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte-app@1.0.0 start: `sirv public "--dev"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte-app@1.0.0 start script.

主要資訊是 Error: getaddrinfo ENOTFOUND localhost,原因盡然是localhost 沒有繫結host,繫結 127.0.0.1 localhost 就OK啦!

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章