mac 安装cnpm 淘宝镜像记录

安装

npm install cnpm -g --registry=https://registry.npm.taobao.org

会报错 没有权限,这时需要加上sudo

sudo npm install cnpm -g --registry=https://registry.npm.taobao.org

这时候如果有些人会报错,证书过期不能访问之类的
需要加上

npm config set strict-ssl false

取消https认证

最后可能会出现的问题就是 npm-v的时候提示报错
在这里插入图片描述
这是因为cnpm版本跟当前npm版本不一致导致
这时候我们需要卸载cnpm

npm uninstall cnpm

然后查看当前npm版本

npm -v

发现当前版本是 6.14.8
在这里插入图片描述
这时我们重新安装cnpm 并且指定版本

sudo npm install -g [email protected] --registry=https://registry.npm.taobao.org

此时我们

cnpm -v

安装成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41615201/article/details/135973351