创建Vue项目vue-cli · Failed to download repo vuejs-templates/webpack: connect ETIMEDOUT
用vue-cli创建项目时显示超时,原因可能是github.com访问不了,用ping命令试一下,显示请求超时
点击查看github.com域名解析之后的ip地址https://github.com.ipaddress.com/,https://fastly.net.ipaddress.com/github.global.ssl.fastly.net
github.global.ssl.fastly.net
根据当前解析的ip地址修改本地的hosts文件,路径为C:\Windows\System32\drivers\etc\hosts,使用管理员身份打开,在后面累加刚才查看的ip地址
140.82.112.3 github.com 199.232.69.194 github.global.ssl.fastly.net
修改完之后的hosts文件为
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 140.82.112.3 github.com 199.232.69.194 github.global.ssl.fastly.net
重新打开命令行窗口
ping github.com
可以看到当前接受100%,可以继续创建项目,显示创建成功。
希望对您有所帮助。。