npm, yarn查看源和换源

npm, yarn查看源和换源

npm config get registry  // 查看npm当前镜像源
npm config set registry https://registry.npmjs.org
yarn config get registry  // 查看yarn当前镜像源
yarn config set registry https://registry.yarnpkg.com

切换为淘宝镜像:

npm config set registry https://registry.npm.taobao.org

yarn config set registry https://registry.npm.taobao.org/

nrm 是一个 NPM 源管理器,允许你快速地在如下 NPM 源间切换

npm install -g nrm
nrm ls

* npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
  taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
nrm use taobao
Registry has been set to: https://registry.npm.taobao.org/
nrm test 

输出:
npm ---- 2930ms
cnpm --- 300ms
taobao - 292ms
nj ----- Fetch Error
rednpm - Fetch Error
npmMirror  1626ms
edunpm - Fetch Error

yrm 是一个 yarn源管理器,允许你快速地在yarn源间切换

npm install -g yrm
yrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
  yarn --- https://registry.yarnpkg.com
yrm use taobao
 YARN Registry has been set to: https://registry.npm.taobao.org/
yrm test

  npm ---- 784ms
  cnpm --- 290ms
* taobao - 297ms
  nj ----- Fetch Error
  rednpm - Fetch Error
  npmMirror  1353ms
  edunpm - Fetch Error
  yarn --- Fetch Error
posted @ 2021-10-13 14:08  eastsae  阅读(307)  评论(0编辑  收藏  举报