-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
When building universal macOS applications (x64 + ARM64) using electron-builder 26.0.20 in a pnpm monorepo workspace, the build fails silently during the universal binary merge step. The same version works perfectly when installed globally.
Environment:
- OS: macOS 26.1 Tahoe (Build 25B78) locally, macOS 15.6 Sequoia (Darwin 24.6.0) in CI
- electron-builder: 26.0.20
- electron: 38.4.0
- Node.js: v22.18.0 (local), v22.14.0 (CI)
- pnpm: 10.12.1
- Workspace: pnpm monorepo with
node-linker=hoisted - Architecture: ARM64 (Apple Silicon) locally, ARM64 (GitHub Actions) in CI
Observed Behavior
When building via pnpm scripts in a monorepo workspace, electron-builder 26.0.20 fails silently during the universal binary creation step:
• packaging platform=darwin arch=x64 electron=38.4.0 appOutDir=dist-electron/mac-universal-x64-temp
• packaging platform=darwin arch=arm64 electron=38.4.0 appOutDir=dist-electron/mac-universal-arm64-temp
• packaging platform=darwin arch=universal electron=38.4.0 appOutDir=dist-electron/mac-universal
(node:2458) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
# Build exits here - no error message, no signing, no DMGResult:
- ✅
mac-universal-x64-temp/directory created - ✅
mac-universal-arm64-temp/directory created - ❌
mac-universal/directory NOT created - ❌ No signing step occurs
- ❌ No DMG creation occurs
- ❌ No error message displayed - the process just exits with code 0 or shows only the deprecation warning
Expected Behavior
The build should complete successfully, creating a universal binary (x64 + ARM64), signing it, notarizing it, and creating DMG/ZIP files, as it does when using the global installation.
Reproduction
Project Structure:
monorepo/
├── .npmrc (node-linker=hoisted)
├── pnpm-workspace.yaml
├── apps/
│ └── desktop/
│ ├── package.json
│ └── electron-builder.config.cjs
└── pnpm-lock.yaml
Steps to reproduce:
- Set up a pnpm monorepo with hoisted node modules
- Install electron-builder 26.0.20 as a dev dependency
- Configure electron-builder for universal macOS builds:
mac: { target: [ { target: 'dmg', arch: ['universal'] }, { target: 'zip', arch: ['universal'] } ] }
- Run via pnpm script:
pnpm exec electron-builder --config electron-builder.config.cjs --mac
Result: Build fails silently at universal merge step
Workaround
The issue is resolved by using a globally installed electron-builder instead of the pnpm workspace version:
package.json:
{
"scripts": {
"release:mac": "cross-env NODE_ENV=production pnpm build && cross-env NODE_ENV=production $(which -a electron-builder | grep -v node_modules | head -1) --config electron-builder.config.cjs --mac"
}
}GitHub Actions:
- name: Install electron-builder globally
run: npm install -g [email protected]
- name: Build
run: pnpm release:mac # Uses global installation via which commandComparison: Working vs Non-Working
| Environment | electron-builder | Execution Method | Result |
|---|---|---|---|
| pnpm workspace (local) | 26.0.20 (hoisted) | Via node_modules/.bin/ |
❌ Fails silently |
| Global (local) | 26.0.20 (global) | Via global path | ✅ Works |
| GitHub Actions (pnpm) | 26.0.20 (workspace) | Via pnpm script | ❌ Fails silently |
| GitHub Actions (global) | 26.0.20 (global) | Via global installation | ✅ Works |
Additional Context
- No error messages are emitted - the process simply stops after logging
• packaging platform=darwin arch=universal - The temp directories for both architectures are created successfully, suggesting the issue is specifically in the
@electron/universalmerge step - Setting
DEBUG=electron-buildershows the process stops after logging "packaging platform=darwin arch=universal" with no subsequent output or error - The silent failure makes debugging extremely difficult - electron-builder should emit an error message when the universal binary creation fails
- Config has
npmRebuild: false, so dependency collection is not involved - Works perfectly in the same pnpm workspace when using global electron-builder
Related Issues
- #8881 - Similar symptoms with pnpm hoisted mode, fixed in PR #8885 (v26.0.9)
- However, that fix does not resolve this specific issue in v26.0.20
Logs
Successful build (global electron-builder):
• packaging platform=darwin arch=universal electron=38.4.0 appOutDir=dist-electron/mac-universal
• signing file=dist-electron/mac-universal/CPAI-D.app platform=darwin type=distribution
• notarization successful
• building target=DMG arch=universal file=dist-electron/app-v1.0.0-darwin-universal.dmg
Failed build (pnpm workspace electron-builder):
• packaging platform=darwin arch=universal electron=38.4.0 appOutDir=dist-electron/mac-universal
(node:2458) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
# Exits here
Request
- Fix the silent failure - at minimum, electron-builder should emit a proper error message when the universal binary merge fails
- Investigate pnpm workspace compatibility - determine why the merge step fails in pnpm workspaces but works with global installation
- Document the workaround - if this cannot be fixed, document that universal builds in pnpm workspaces may require global installation