引言
npm是node包管理和分发工具,应用十分广泛。但是在实际使用中常常会发现下载过程十分缓慢。其实是因为npm本身自带的源为https://registry.npmjs.org/,而这个源在国内使用的时候十分缓慢,为了方便使用,提高npm下载速度,可以更换国内的优秀npm镜像。
一、国内优秀镜像
国内优秀的npm镜像有:
1.1 淘宝镜像
- 搜索地址:http://npm.taobao.org/
- registry地址:http://registry.npm.taobao.org/
1.2 cnpmjs镜像
- 搜索地址:http://cnpmjs.org/
- registry地址:http://r.cnpmjs.org/
二、更换源
更换npm默认镜像源有两种方式,分别为临时更换和永久更换。
2.1 临时更换
-
临时更换为淘宝镜像
npm --registry=http