Error: getaddrinfo ENOTFOUND localhost

慈云数据 2024-03-19 技术支持 119 0

一、背景:

启动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

 

微信扫一扫加客服

微信扫一扫加客服

点击启动AI问答
Draggable Icon