electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.33k stars 492 forks source link

electron-forge@7.2 can't handle universal arch native node.js module correctly on macOS. #3447

Open ChrisChou-freeman opened 6 months ago

ChrisChou-freeman commented 6 months ago

Pre-flight checklist

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 leveldown@6.1.1, then pack app in universal arch with electron-forge@7.2.0 on macOS.

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

Additional information

No response

ChrisChou-freeman commented 6 months ago

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