electron-builder 在打包universal的时候报错 both x64 and arm64 builds and not cover

 ⨯ Detected file "Contents/Resources/src/files/adbtool/mac/adb" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule: "undefined"  failedTask=build stackTrace=Error: Detected file "Contents/Resources/src/files/adbtool/mac/adb" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule: "undefined"
    at makeUniversalApp (app/node_modules/@electron/universal/src/index.ts:148:17)

错误的原因是 electron-builder监测到 你打包了x64,arm64架构等。
但同时你在项目中可能使用了某些在x64架构上编译的二进制文件,但是没有为arm64架构提供对应的版本。
建议考虑周全!

解决办法: 在 electron-builder.json 文件增加一行


  "mac": {
    ...
    "x64ArchFiles":"*"
  },

参考 https://github.com/electron/forge/issues/3125

posted @ 2024-10-15 10:06  丁少华  阅读(51)  评论(0编辑  收藏  举报