用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%,可以繼續創建項目,顯示創建成功。
希望對您有所幫助。。