Error: connect ETIMEDOUT xxx.xxx.xx.xxx:xxxx

  • 问题描述:Error: connect ETIMEDOUT xxx.xxx.xx.xxx:xxxx
    显示的是连接错误,链接时间超时,附带下载地址
    报错图片
    这个问题一般是在使用npm或yarn安装依赖是报错。
  • 问题原因:一般是因为下载依赖的服务器访问不到造成的,大家都懂得。
  • 解决办法:将npm或yarn的下载镜像地址修改一下

yarn修改镜像地址
1、查看一下当前源:yarn config get registry
2、切换为淘宝源:yarn config set registry https://registry.npm.taobao.org
3、还原仓库地址:yarn config set registry https://registry.yarnpkg.com

npm修改镜像地址:
1、查看一下当前源:npm config get registry
2、切换为淘宝源:npm config set registry https://registry.npm.taobao.org/
3、还原仓库地址:npm config set registry https://registry.npmjs.org/
4、删除会恢复默认镜像:npm config delete registry

或者也可以使用nrm修改镜像地址。
1.查看允许切换的资源地址:nrm ls
2.将下载地址切换到淘宝:nrm use taobao

补充见:
NodeJS之nrm/cnpm的安装
NodeJS环境下,使用NPM管理包


版权声明:本文为Cao_Mary原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。