因想使用脚手架cli创建vue项目,在第一次使用npm update -g @vue/cli,下载速度很慢,有时候还会卡住进度条,最后提示安装失败。
故命令行中使用
npm config get registry查看到下载地址是https://registry.npmjs.org/,
然后
使用
npm config set registry https://registry.npm.taobao.org
命令将默认下载地址改成淘宝镜像
再次使用pm update -g @vue/cli出现npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED npm ERR! requ
在查阅资料之后使用命令
npm config set registry http://registry.cnpmjs.org
npm config set registry http://registry.npm.taobao.org
再次执行npm update -g @vue/cli很快成功