原始源
# the original source
https://registry.npmjs.org/
方案: 使用nrm
- 安装
npm install -g nrm
- 列出源的候选项
nrm ls
输出结果:
* npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npm.taobao.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
- 使用淘宝源
nrm use taobao
方案: 改变全局的注册
- 设置成淘宝源
npm config set registry https://registry.npm.taobao.org
SH 复制 全屏
- 查看结果
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]