npm run dev 之后 Error: getaddrinfo ENOTFOUND localhost
程序员文章站
2022-05-13 17:14:20
...
编译出现Error: getaddrinfo ENOTFOUND localhost,原因 没有指定 localhost
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
yindeyongdeMacBook-Air:reactchatroom yindeyong$ webpack-dev-server
events.js:160
throw er; // Unhandled 'error' event
^
解决办法 在host 文件中添加
127.0.0.1 localhost
1. sudo vi /etc/hosts加:127.0.0.1 localhost
2 如果使用过switchHost,一定要写默认host