一般安装依赖包,都是使用 npmjs 镜像安装,或者使用淘宝镜像安装。
比如:
npm i react
查看当前镜像:
npm config get registry
当面对 npmjs 镜像无法访问以及淘宝 npm 镜像(cnpm)SSL 证书过期的问题,可以采取以下几种方法来安装 npm 包:
- 使用其他可用的 npm 镜像
除了淘宝的 npm 镜像外,还有其他一些镜像源可供选择,比如:
阿里云 npm 镜像:
npm config set registry https://registry.npmmirror.com/
华为云 npm 镜像:
npm config set registry https:/