设置npm源的几种方式
原始源
# 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/
方案: 改变全局的注册
//设置成淘宝源
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]
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。