universal: Can't reconcile two non-macho files

In macOS 12.3, Apple removed Python 2. electron-builder v23.0.0 added Python 3 support to resolve the issue. However, electron-universal now fails to package the universal app.

Full Error Message:

  • electron-builder  version=23.0.0 os=21.4.0
  • loaded configuration  file=package.json ("build" field)
  • loaded parent configuration  file=/Users/me/razer-macos/node_modules/electron-webpack/out/electron-builder.js
  • writing effective config  file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild  platform=darwin arch=x64
  • packaging       platform=darwin arch=x64 electron=12.2.3 appOutDir=dist/mac-universal--x64
  • executing node-gyp rebuild  platform=darwin arch=arm64
  • packaging       platform=darwin arch=arm64 electron=12.2.3 appOutDir=dist/mac-universal--arm64
  • packaging       platform=darwin arch=universal electron=12.2.3 appOutDir=dist/mac-universal
  ⨯ Can't reconcile two non-macho files build/Makefile  failedTask=build stackTrace=Error: Can't reconcile two non-macho files build/Makefile
    at Object.exports.mergeASARs (/Users/BobWhite/razer-macos/node_modules/@electron/universal/src/asar-utils.ts:151:13)
    at exports.makeUniversalApp (/Users/BobWhite/razer-macos/node_modules/@electron/universal/src/index.ts:200:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at MacPackager.doPack (/Users/BobWhite/razer-macos/node_modules/app-builder-lib/src/macPackager.ts:125:9)
    at MacPackager.pack (/Users/BobWhite/razer-macos/node_modules/app-builder-lib/src/macPackager.ts:179:7)
    at Packager.doBuild (/Users/BobWhite/razer-macos/node_modules/app-builder-lib/src/packager.ts:441:9)
    at Object.executeFinally (/Users/BobWhite/razer-macos/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/Users/BobWhite/razer-macos/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/Users/BobWhite/razer-macos/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/Users/BobWhite/razer-macos/node_modules/builder-util/src/promise.ts:12:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
./dist/mac-universal/Razer macOS.app: No such file or directory

Does electron-universal directly utilize Python 2?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 33 (11 by maintainers)

Most upvoted comments

Adding this to files in electron-builder config fixes the problem for us: '!node_modules/**/*.{mk,a,o,h}'

It basically ignores all the C/C++ build files from packaging

In this command from the logs above ☝️

 Command failed: lipo /private/var/folders/y5/pp8xq1qd1f78jth_11nsxndh0000gn/T/arm64-mw1MJx/node_modules/argon2/bin/darwin-arm64-113/argon2.node /private/var/folders/y5/pp8xq1qd1f78jth_11nsxndh0000gn/T/x64-BD57LD/node_modules/argon2/bin/darwin-arm64-113/argon2.node -create -output /private/var/folders/y5/pp8xq1qd1f78jth_11nsxndh0000gn/T/x64-BD57LD/node_modules/argon2/bin/darwin-arm64-113/argon2.node

Both paths for lipo are the same. /private/var/folders/y5/pp8xq1qd1f78jth_11nsxndh0000gn/T/arm64-mw1MJx/node_modules/argon2/bin/darwin-arm64-113/argon2.node Note the arm64-113/argon2.node in both /T/arm64-mw1MJx and /T/x64-BD57LD dirs This seems like a bug in electron/universal? Why is lipo being used on a single-arch file?

I’ve got a similar issue, however with node-mac-permissions package:

Same with usb-detection. The binary is already universal.

For now, I have to stay with version 22.xx.xxx Python 2 (can be downloaded from here: https://www.python.org/downloads/release/python-2718/)

Don’t forget to tell electron-builder where to find it using the PYTHON_PATH Variable:

export PYTHON_PATH=/usr/local/bin/python
yarn electron-builder

Edit 1: it also works with electron-builder v23, as long as you set "mergeASARs": false. However, I’d really like to merge asars…

Edit 2: The binary of usb-detection is not in mach-o format. That is why it does not work. That means, it’s not a bug of electron/universal but rather of usb-detection.

Edit 3: It seems like the binary is in Mach-O format, but already contains both architectures:

hannes@macmini node-usb-detection % file build/Release/detection.node
build/Release/detection.node: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bot bundle x86_64Mach-O 64 bit undle x86_64] [arm64:Mach-O 64-bit bundle arm64Mach-O 64-bit bundle arm64]
build/Release/detection.node (for architecture x86_64): Mach-O 64-bit bundle x86_64
build/Release/detection.node (for architecture arm64): Mach-O 64-bit bundle arm64

Seems like electron/universal can’t process those binaries?

@oltreseba you might need to exclude everything from "!**/node_modules/better-sqlite3/build/**" and add back the "node_modules/better-sqlite3/build/Release/better_sqlite3.node",. Even without merging ASARs you really don’t want to have these extra files around because they could take a lot of space.

Can confirm the same issue with node-mac-permissions with a small difference.

First trip up is on node_modules/node-mac-permissions/node-addon-api/nothing.target.mk