admin管理员组文章数量:1278914
I have a problem with building separate images for macOS for both main architectures for an electron-based application.
I use electron-builder
with this config:
electron-builder.yml
:
# ...
npmRebuild: true
mac:
target:
- target: default
arch: x64
- target: default
arch: arm64
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
category: public.app-category.productivity
artifactName: ${name}-macos-${version}-${arch}.${ext}
dmg:
artifactName: ${name}-${version}-${arch}.${ext}
# ...
As you can see I have both the ARM64
and the X64
architectures set as targets, with npmRebuild
set as true.
I also have postinstall
defined within the package.json
file:
{
// ...
"scripts": {
// ...
"postinstall": "electron-builder install-app-deps",
// ...
}
}
Both DMG
files build successfully and seemingly both have the proper architecture.
However, while running the X64
application, I always get this error:
.../Release/better_sqlite3.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))
When building the application, it seemingly does the proper thing:
• executing @electron/rebuild electronVersion=34.0.2 arch=x64 buildFromSource=false appDir=./
• installing native dependencies arch=x64
• preparing moduleName=better-sqlite3 arch=x64
• finished moduleName=better-sqlite3 arch=x64
• completed installing native dependencies
• packaging platform=darwin arch=x64 electron=34.0.2 appOutDir=dist/mac
# ...
• Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
• installing native dependencies arch=arm64
• preparing moduleName=better-sqlite3 arch=arm64
• finished moduleName=better-sqlite3 arch=arm64
• completed installing native dependencies
• packaging platform=darwin arch=arm64 electron=34.0.2 appOutDir=dist/mac-arm64
版权声明:本文标题:npm - Build both ARM64 and X64 macOS targets with electron-builder including their dependencies - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741238365a2363474.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论