svelte 运行报错 getaddrinfo ENOTFOUND localhost

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 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!