使用原来的registry.npm.taobao.org域名报了个错误,需要切换新的源地址。
- // 1. 如果不确定可以先检测一下自己使用了那个镜像源
- npm config get registry
-
- // 2. 清理一下缓存
- npm cache clean --force
-
- // 3. 切换新的源地址
- npm config set registry https://registry.npmmirror.com
如果需要安装cnpm,则使用:
- //安装cnpm
- npm install -g cnpm --registry=https://registry.npmmirror.com
-
- //检测是否安装成功
- cnpm -v
除了淘宝的镜像,也可以选择其他镜像:
腾讯: http://mirrors.cloud.tencent.com/npm/
华为:https://mirrors.huaweicloud.com/repository/npm/
中科大镜像: https://registry.npmjs.org/