electron-userland / electron-installer-dmg

Create DMG installers for your electron apps using appdmg.
https://github.com/electron-userland/electron-installer-dmg
Apache License 2.0
314 stars 39 forks source link

createDMG fails when running on m1 mac when running under x86_64 architecture #215

Open adesko opened 1 month ago

adesko commented 1 month ago

I'm trying to build an app for x86_64 on m1 mac. I'm running the build scripts through the compatibility layer, so it looks like this arch -86_64 /path/build_app.sh I have different versions of node for arm and x86 installed, so this particular script is running with node for x86. So when the script is running, it detects the architecture as x86 and tries to run a command that is incompatible with arm Macs

15:05:35.200 › Command failed: bless --folder /Volumes/SPINSInstaller --openfolder /Volumes/SPINSInstaller
bless: The 'openfolder' is not supported on Apple Silicon devices.

Is there any way to avoid this error and build for x86 on an arm machine?

erickzhao commented 1 month ago

Duplicate of https://github.com/electron-userland/electron-installer-dmg/issues/131. Should be fixed as of v4.0.0.

adesko commented 1 month ago

@erickzhao i fail to see how it's a duplicate. The issue you linked describes building an app for arm64. I, however, am trying to build an app under x86_64 architecture, but on an arm mac. So inside of node, the process.arch is x64 so it tries to execute with "openfolder" but fails since it's not available on arm macs. Also, i'm using the 5.0.1 version of the package.

erickzhao commented 1 month ago

@adesko Ah I see, my apologies. Have you tried packaging your app for x64 and using electron-installer-dmg on the output result without the arch -86_64 translation?

Not immediately sure if there's anything platform-specific about the resulting DMG and I don't have an x64 Mac on me to test.

adesko commented 1 month ago

@erickzhao unfortunately that didn't work Since node_modules were installed under arm architecture, the resulting app won't run on x86 macs (though the dmg file can be opened and the app can be copied to Applications) And when installing node_modules under x86, i get the error above since electron-installer-dmg was also installed under x86 together with other modules