npm install and switch Taobao mirror

The default mirror source of npm is from abroad, and the installation speed of dependencies is slow. It will be faster to use domestic mirror sources.

1. Set up Taobao mirror source:

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

2. View the current image source:

npm config get registry

3. Set the official image source:

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

You can also use nrm to view and switch images

//安装nrm,一定要全局安装
npm install -g nrm
//nrm查看所有镜像源命令,带*即为当前使用的源
nrm ls
  npm ---------- https://registry.npmjs.org/
  yarn --------- https://registry.yarnpkg.com/
  tencent ------ https://mirrors.cloud.tencent.com/npm/
  cnpm --------- https://r.cnpmjs.org/
* taobao ------- https://registry.npmmirror.com/
  npmMirror ---- https://skimdb.npmjs.com/registry/
 
//如果使用nrm ls发现全面都没有带*,则可以参考最后面的教程
 
//切换镜像源命令
nrm use xxx  //例:nrm use taobao 就可以切换自己想用的镜像源了
 
//当前使用的源
nrm current
taobao
 

Guess you like

Origin blog.csdn.net/Achong999/article/details/127397533