npm install yarn - g 出现错误

执行下面代码:
bash
npm cache clean --force
npm config set strict-ssl false
重新按照yarn按照成功。
bash
npm install yarn - g
前置一定要设置配置镜像:
bash
npm config set registry https://r.cnpmjs.org/
查看镜像是否配置成功
bash
npm config get registry