Error: getaddrinfo ENOTFOUND localhost

一、背景:

在启动vue ui的时候,报错了。

报错信息:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND localhost
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
Emitted 'error' event on WebSocketServer instance at:
    at Server.emit (node:events:513:28)
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:1934:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:17) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'localhost'
}

Node.js v18.14.2

Error: getaddrinfo ENOTFOUND localhost_第1张图片

二、解决办法

修改host,在hosts文件中,加入

127.0.0.1 localhost

 

你可能感兴趣的:(问题处理,vue.js,前端,javascript)