npm的默认源是国外的,在日常下载中可能下载速度会较慢,我们可以将默认源切换到国内来加快下载速度。
1、查看当前npm所有配置:npm config list
2、查看npm当前默认源:npm config get registry
3、设置淘宝镜像:npm config set registry https://registry.npmmirror.com/
4、设置官方镜像:npm config set registry https://registry.npmjs.org
5、单次下载使用:npm --registry=http://registry.npmmirror.com install
评论 (0)