当前位置:   article > 正文

NodeJS yarn 或 npm如何切换淘宝或国外镜像源_node切换淘宝镜像

node切换淘宝镜像

一、查看当前的镜像源

  1. npm config get registry
  2. yarn config get registry

二、设置为淘宝镜像源(全局设置)

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

注意:npm 和 yarn 是两个不同的包管理器,如果两个都想用淘宝镜像,则分别都要设置

三、切换回默认镜像源(全局设置)

首先要找到默认的镜像源,然后根据第二步进行设置,即可切回默认镜像源

  1. 常用的 默认镜像源
  2. npm ---- https://registry.npmjs.org
  3. yarn --- https://registry.yarnpkg.com

如果你不记得 镜像源,可以借助 nrm 这个工具进行查询

1.安装 nrm 工具

npm install nrm -g

2.查询 镜像源列表

nrm ls

查询成功,如下所示

  1. npm ---- https://registry.npmjs.org
  2. cnpm --- http://r.cnpmjs.org
  3. taobao - https://registry.npm.taobao.org
  4. nj ----- https://registry.nodejitsu.com
  5. npmMirror https://skimdb.npmjs.com/registry
  6. edunpm - http://registry.enpmjs.org
  7. yarn --- https://registry.yarnpkg.com
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/831069
推荐阅读
相关标签
  

闽ICP备14008679号