1-问题描述:当我们直接用vue init webpack demo 脚手架创建项目时,直接无限downloading template),或者说一直卡着不动,等了一会报错vue-cli · Failed to download repo vuejs-templates/webpack: connect ETIMEDOUT 13.229.188.59:443

解决方法:
  1. 方法一:(设置代理地址)我的就是这么解决的
    直接修改系统的hosts文件,文件地址:C:\Windows\System32\drivers\etc 看是否是默认配置。默认配置如下:
# 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
#192.30.253.112 github.com
#151.101.88.249 github.global.ssl.fastly.net
  1. 注意:(一定要以管理员的身份打开,或者保存的时候以管理员的身份保存,切记,否则修改不成功)
  • 你的hosts文件直接鼠标右键用记事本打开,或者VSCode、Nodepad++打开,在里面添加以下代理地址:
#192.30.253.112 github.com
#151.101.88.249 github.global.ssl.fastly.net
  1. 或者直接把上面我的复制到新建txt,直接改后缀名为hosts文件

  1. 方法二:
    可能是webpack版本问题,要重新安装webpack
npm uninstall -g webapck
npm install -g webapck
  1. 方法三:
    如果方法一、二解决不了,检查三个环境问题(可能又是版本问题)
  1. node -v(查看node版本)
  2. vue -v (没有显示版本,直接npm i vue-cli -g)
  3. webpack-v(需要重新安装,npm install webpack -g)
  • 当你以上命令都安装过,并且显示版本号时,vue init webpack demo脚手架创建项目,一直没有反应,可能时node版本的问题
  • 所以直接node官网下载更新node.js覆盖版本就可以了、

2-以上方法大概足够解决报错的问题了,那么接下来谈一谈hosts文件

2.1-Hosts文件是什么
  • Hosts文件主要作用是定义IP地址和主机名的映射关系,是一个映射IP地址和主机名的规定。
  • 可以用文本文件打开!当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,浏览器会立即打开对应网页,如果没有找到,则浏览器会将网址提交DNS服务器进行IP地址解析。这也是提高快速打开网页的方法!
2.2-Hosts文件位置在哪里?

c:\windows\system32\drivers\etc,注意这个文件一定是在系统盘,如果你的系统在D盘请自行修改前面的盘符。如下图所示

you are in emergency mode 卡死 卡在entered download mode_github


快速进入hosts文件夹的方法。同时按下Win+R组合键,调出运行栏,在运行文本框输入c:\windows\system32\drivers\etc,点击确定按钮,如下图所示

you are in emergency mode 卡死 卡在entered download mode_Vue脚手架创建项目一直等待_02


具体修改方法上面说了,希望大家可以拜托这个卡死的BUG