Total Pageviews

Saturday, 8 June 2024

electron常见问题整理


打包慢的问题

方法1:进入以下链接手动下载对应版本:

https://registry.npmmirror.com/binary.html
将压缩包复制到对应的本地缓存目录

Linux:~/.cache/electron/

macOS:~/Library/Caches/electron/

#  C:Users用户名AppDataLocalelectronCache
Windows:~/AppData/local/electron/Cache

winCodeSign和nsis 同理

# 下载后解压到
~/AppData/local/electron-builder/cache/nsis
~/AppData/local/electron-builder/cache/winCodeSign



方法2(设置代理):

# yarn
yarn config set proxy "http://127.0.0.1:7890"
yarn config set https-proxy "http://127.0.0.1:7890"

# npm
npm config set proxy "http://127.0.0.1:7890"
npm config set https-proxy "http://127.0.0.1:7890"


mac打包遇到Detected unique file:
    ⨯ Detected unique file "node_modules/nodemon/node_modules/fsevents/build/Release/fse.node" in "/tmp/electron-universal-quBZOj/Tmp.app/Contents/Resources/app.asar" not covered by allowList rule: "undefined" failedTask=build stackTrace=Error: Detected unique file "node_modules/nodemon/node_modules/fsevents/build/Release/fse.node" in "/tmp/electron-universal-quBZOj/Tmp.app/Contents/Resources/app.asar" not covered by allowList rule: "undefined"

WX20240221-164001111111111.jpg 配置项加上 singleArchFiles (见:https://github.com/electron-userland/electron-builder/issues/6862):

...
"singleArchFiles": "*",
...

mac打包遇到ERR_ELECTRON_BUILDER_CANNOT_EXECUTE

通常是mac打包x64、arm64时使用了同一个文件名,带上${arch}即可
...
"artifactName": "${productName}_${version}.${arch}.${ext}",
...


No comments:

Post a Comment