今天创建项目的时候报错timeout
vue init webpack richtext
vue-cli · Failed to download repo vuejs-templates/webpack: connect ETIMEDOUT 223.75.236.241:443
但是这个报错的ip可以ping通。于是就想到自己去github上下载webpack。
https://github.com/vuejs-templates/webpack
如果直接下载zip,下载的名称是webpack-develop.zip,解压后将webpack-develop改名为webpack,然后将webpack复制到c:\users\xxxxx\.vue-templates目录里面。然后执行
vue init webpack --offline
如果报错
Cannot read property 'pickAlgorithm' of null
尝试
- npm cache clear --force
-
- npm install
github访问失败的问题
可以ping通,但是打不开网页,所以开了代理,但是执行git clone的时候还是报错timeout
于是把自己的代理的端口配置到git命令中
- git config --global https.proxy 127.0.0.1:10809
-
- git config --global http.proxy 127.0.0.1:10809
然后git clone执行成功了。最后需要同构如下命令取消配置
- git config --global --unset http.proxy
-
- git config --global --unset https.proxy
安装 npm install -g vue-cli 报错 ‘proxy‘ config is set properly
清除/禁用
- npm config set proxy false
- npm cache clean --force
或
- npm config get proxy
- npm config get npm config get https-proxy