npm 下载依赖问题:node-pre-gyp ERR! install request to ... failed, reason: read ECONNRESET

问题与处理策略

问题描述
  • 在 Vue 项目中,执行 npm i 下载依赖时,报如下错误
node-pre-gyp ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v72-win32-unknown-x64.tar.gz 
failed, reason: read ECONNRESET 

node-pre-gyp WARN Pre-built binaries not installable for canvas@2.9.3 and node@12.22.12 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)

node-pre-gyp WARN Hit error request to https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v72-win32-unknown-x64.tar.gz 
failed, reason: read ECONNRESET
问题原因
  • 这个问题是从 GitHub 下载预编译二进制文件时网络连接不稳定或被中断
处理策略
  1. 使用镜像源下载
npm config set registry=https://registry.npmmirror.com/
  1. 或者,调整网络超时设置
npm config set fetch-retry-mintimeout 30000
npm config set fetch-retry-maxtimeout 180000
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值