forge icon indicating copy to clipboard operation
forge copied to clipboard

[email protected] can't handle universal arch native node.js module correctly on macOS.

Open ChrisChou-freeman opened this issue 2 years ago • 1 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.2.0

Electron version

28.0.0

Operating system

macOS 14.1.1

Last known working Electron Forge version

6.4.2

Expected behavior

run electron-forge make --arch=universal --platform=mas package successfully

Actual behavior

throw error message below, seems 7.2 version not handle osxUniversal config option correct.

(because when i remove this config option in 6.4 version, it will throw an error "leveldown.node" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule: "undefined", but it's not throw this error message until the error message below throw in version 7.2 when i remove osxUniversa config optionl).

An unhandled rejection has occurred inside Forge:
Error: Command failed with a non-zero return code (1):
lipo /private/var/folders/yp/_j1q49v91zj6vb42fzt6fcs40000gn/T/electron-universal-c5APVS/Tmp.app/Contents/Resources/app/.webpack/main/native_modules/build/Release/leveldown.node /private/var/folders/yp/_j1q49v91zj6vb42fzt6fcs40000gn/T/electron-packager/electron-packager-universal-X5PsiV/Simark-mas-arm64/Simark.app/Contents/Resources/app/.webpack/main/native_modules/build/Release/leveldown.node -create -output /private/var/folders/yp/_j1q49v91zj6vb42fzt6fcs40000gn/T/electron-universal-c5APVS/Tmp.app/Contents/Resources/app/.webpack/main/native_modules/build/Release/leveldown.node

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /private/var/folders/yp/_j1q49v91zj6vb42fzt6fcs40000gn/T/electron-universal-c5APVS/Tmp.app/Contents/Resources/app/.webpack/main/native_modules/build/Release/leveldown.node and /private/var/folders/yp/_j1q49v91zj6vb42fzt6fcs40000gn/T/electron-packager/electron-packager-universal-X5PsiV/Simark-mas-arm64/Simark.app/Contents/Resources/app/.webpack/main/native_modules/build/Release/leveldown.node have the same architectures (x86_64) and can't be in the same fat output file
at ChildProcess.<anonymous> (/Users/chrischou/Developer/NodeJsProject/simark/node_modules/@malept/cross-spawn-promise/dist/src/index.js:101:24)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:514:28)
    at Socket.emit (node:domain:488:12)
    at Pipe.<anonymous> (node:net:337:12)

Steps to reproduce

try to install any node.js package include native module, for example [email protected], then pack app in universal arch with [email protected] on macOS.

electron-forge make --arch=universal --platform=mas`

Additional information

No response

ChrisChou-freeman avatar Dec 19 '23 08:12 ChrisChou-freeman

currently i decide to roll back to 6.4 version, and it's working fine.

ChrisChou-freeman avatar Dec 19 '23 08:12 ChrisChou-freeman

same issue here, any updates?

xueqingxiao avatar Apr 07 '25 12:04 xueqingxiao

Similar issue here, in my case:

Error: Detected file "Contents/Resources/app.asar.unpacked/node_modules/fsevents/fsevents.node" that's the same in both x64 and arm64 builds and not covered by the x64ArchFiles rule

I'm not sure if it's the same root cause as the original issue, but for me, I tracked it down to @electron/universal 2.0.2 (2.0.1 didn't have the issue), specifically this change

Seems that there's a pending PR that will fix this https://github.com/electron/universal/pull/126

valeriangalliat avatar Apr 29 '25 15:04 valeriangalliat

electron/universal fix has been merged and released under v2.0.3

You should be able to override the subdependency in your package.json until electron/universal is updated in this project

mmaietta avatar May 02 '25 16:05 mmaietta