npm安装、切换淘宝镜像

npm安装、切换淘宝镜像

npm默认镜像源是国外的,安装依赖速度较慢,使用国内的镜像源速度会快一些。

1、设置淘宝镜像源:

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

2、查看当前镜像源:

npm config get registry

3、设置官方镜像源:

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

还可以使用nrm查看和切换镜像

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

转载请说明出处内容投诉
AJ教程_站长资源网 » npm安装、切换淘宝镜像

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买