本文介绍: 是国外的,安装依赖速度较慢,使用国内的镜像源速度会快一些。

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.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
 

原文地址:https://blog.csdn.net/Achong999/article/details/127397533

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_20406.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注