npm和yarn包管理器报错

在尝试使用yarninstall命令安装Electron时遇到了错误,具体表现为命令执行失败,错误信息显示生成的zip文件校验和不匹配。为了解决这个问题,建议在.npmrc文件中添加Electron的镜像源,设置ELECTRON_MIRROR和ELECTRON_BUILDER_BINARIES_MIRROR为国内镜像地址,以加速并可能解决下载问题。
摘要由CSDN通过智能技术生成

npm和yarn包管理器报错

提示:这里描述项目中遇到的问题:

运行yarn install安装electron报错:

D:\Javaproject(idea)\electron-project0>yarn install                                                                                       
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error D:\Javaproject(idea)\electron-project0\node_modules\electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: D:\Javaproject(idea)\electron-project0\node_modules\electron
Output:
Error: Generated checksum for "electron-v19.0.12-win32-x64.zip" did not match expected checksum.
    at Hash.<anonymous> (D:\Javaproject(idea)\electron-project0\node_modules\sumchecker\index.js:133:20)
    at Hash.emit (node:events:513:28)
    at emitReadable_ (node:internal/streams/readable:590:12)
    at onEofChunk (node:internal/streams/readable:568:5)
    at readableAddChunk (node:internal/streams/readable:275:5)
    at Readable.push (node:internal/streams/readable:234:10)
    at node:internal/streams/transform:145:12
    at Hash._flush (node:internal/crypto/hash:96:3)
    at Hash.final [as _final] (node:internal/streams/transform:132:10)
    at callFinal (node:internal/streams/writable:698:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

解决方案:

在.npmrc 文件(一般在C盘的user目录下)添加electron相关镜像

ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值