解决 Error: getaddrinfo ENOTFOUND localhost.localdomain

关于这个问题,我查询了大量的文章,都指向了/etc/hosts文件。

但是,我的/etc/hosts文件已经包含了如下内容:

# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#    
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts

localhost已经设置过了,真是让人蛋疼。。。

于是,我搜索了一下localhost.localdomain到底是什么,原来是和localhost一样的东西,只是名称不同。

所以我把localhost.localdomain也加入到了/etc/hosts文件中,如下:

127.0.0.1       localhost.localdomain localhost

问题解决!

解决 Error: getaddrinfo ENOTFOUND localhost.localdomain_第1张图片

你可能感兴趣的:(vue.js,node.js)