参考:
1. Electron安装报错 RequestError: read ECONNRESET
2. electron安装, node install.js报错RequestError: read ECONNRESET问题解决方案
3. 关于 downloadArtifact 使用方法
https://www.npmjs.com/package/@electron/get
我的问题
vue项目,使用yarn安装electron依赖时(yarn add electron)报错:RequestError: read ECONNRESET
原因
依赖源问题
解决方法
1.进入 node_modules/electron文件下, 编辑install.js文件
2. 修改downloadArtifact这段代码, 添加淘宝镜像地址https://npm.taobao.org/mirrors/electron
原来downloadArtifact部分:
修改后:
downloadArtifact({ version, artifactName: 'electron', force: process.env.force_no_cache === 'true', cacheRoot: process.env.electron_config_cache, checksums: process.env.electron_use_remote_checksums ?? process.env.npm_config_electron_use_remote_checksums ? undefined : require('./checksums.json'), // 重点!! mirrorOptions: { mirror: 'https://npm.taobao.org/mirrors/electron', platform, arch, }, }).then(extractFile).catch(err => { console.error(err.stack); process.exit(1); });
3.执行命令:yarn add electron
标签:vue,ECONNRESET,read,yarn,blog,electron,RequestError From: https://www.cnblogs.com/linjiangxian/p/18044852