设置npm源
原始源
# the original source
https://registry.npmjs.org/
- 设置成淘宝源
npm config set registry https://registry.npm.taobao.org
- 查看结果
npm config get registry
输出结果:
https://registry.npm.taobao.org/
- 测试一下
npm info underscore
命令行指定源
npm --registry https://registry.npm.taobao.org install [name]
修改 ~/.npmrc
registry = https://registry.npm.taobao.org
使用cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install [name]