设置npm源的几种方式


设置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/
  • 使用淘宝源
nrm use taobao

方案: 改变全局的注册

  • 设置成淘宝源
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]

参照

淘宝源链接


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM