欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

npm、yarn 查看源代码和更改源代码

最编程 2024-03-14 09:57:42
...

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