npm使用国内镜像
- 临时使用
npm --registry https://registry.npm.taobao.org install express
- 持久使用
npm config set registry https://registry.npm.taobao.org
配置后可通过下面方式来验证是否成功
npm config get registry // 或 npm info express
使用cnpm
- 安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 使用cnpm
cnpm install xxx
目前遇到的小区别,在新项目下可以使用
npm install .
或者
npm install
进行安装依赖包,使用cnpm仅支持后者,即
cnpm install
(完)