electron 如何交叉打包到不同的平台?

337 天前
 join

我的 app 写完了一个 draft 版本,现在我想打包它。我的机器是 Linux ,用的是 electron-builder 打包。
打包 pkg 时会跳过,告诉我必须要签名才行。
skipped macOS application code signing reason=supported only on macOS

打包 windows 时会有以下错误:
/node_modules/builder-util/src/util.ts:133:18

Exit code: ENOENT. spawn productbuild ENOENT failedTask=build stackTrace=Error: Exit code: ENOENT. spawn productbuild ENOENT

现在我只能看到 linux 的 appimage 可以用了。
我的 package.json

 "mac": {
      "category": "public.app-category.education",
      "target": "pkg"
    },
    "linux":{
      "target": "AppImage"
    },
    "win":{
      "target": "nsis"
    },

打包命令用的是:

electron-builder -mwl

现在我网上搜索一圈看下来,打包 mac 的应用必须要在 mac 上才行,因为签名只能在 macosx 上完成。
你们是怎么在一个机器上打包三个不同的平台的?( mac/linux/windows )

1255 次点击
所在节点    Electron
3 条回复
molvqingtai
337 天前
GitActions 提供 macos 环境,不知道能不能用作打包
duan602728596
336 天前
线上 github actions 用 macos 环境打包。本地开发直接用 mac
join
322 天前
最后还是靠 github actions ,感谢楼上二位老哥。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/944032

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX