npm国内镜像cnpm安装不了
错误原因
淘宝镜像原来的域名于2022年5月31号起停止访问,更改为https://registry.npmmirror.com
解决方法
npm config set registry --registry=https://registry.npmmirror.com
之前的镜像不能用了重新设置一下后执行
npm install -g cnpm --registry=https://registry.npmmirror.com
可能会提示npm版本需要更新,跟着提示语句,更新就好
提示语句有两种解决方法,两个结果一直,第一个比较方便一些,第二个可能有其他问题出现要一并解决:
1.在github下载,安装后,直接解压,替换就好了。
https://github.com/npm/cli/releases/tag/v8.11.0
2.npm install -g npm@8.11.0