一、背景:
在启动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
二、解决办法
修改host,在hosts文件中,加入
127.0.0.1 localhost