如果打开前端项目(node充当服务端,如Vue,React等),报如下错误:
Error: listen EADDRNOTAVAIL: address not available xxx.xxx.xxx.xxx:xxxx
上面的意思就是说本地IP地址不可用,如果此时你执行
ping localhost
会得到和上面错误信息中一样的地址,在此分析是一些软件(如翻墙代理)污染了本地hosts文件,请将本地hosts文件中的localhost恢复成原来的即可。
可参考:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
如有补充,欢迎评论!