electron-forge publish hangs on "Preparing native dependencies"
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.4.0
Electron version
v30.0.6
Operating system
Github Runner, macos-latest
Last known working Electron Forge version
No response
Expected behavior
The github runner will build and publish.
Actual behavior
The runner hangs on the "preparing native dependencies" step, with no error or further info, only for the OSX build. For windows it build fine. I suspect this may have something to do with code signing.
Steps to reproduce
My forge config:
import type { ForgeConfig } from "@electron-forge/shared-types";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { MakerDMG } from "@electron-forge/maker-dmg";
import { AutoUnpackNativesPlugin } from "@electron-forge/plugin-auto-unpack-natives";
import { WebpackPlugin } from "@electron-forge/plugin-webpack";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
import { mainConfig } from "./webpack.main.config";
import { rendererConfig } from "./webpack.renderer.config";
const config: ForgeConfig = {
packagerConfig: {
asar: true,
icon: "./src/assets/icon",
osxSign: {
identity: `Developer ID Application: ${process.env.APPLE_IDENTITY!}`,
},
osxNotarize: {
appleId: process.env.APPLE_ID!,
appleIdPassword: process.env.APPLE_PASSWORD!,
teamId: process.env.APPLE_TEAM_ID!,
},
},
rebuildConfig: {},
makers: [new MakerSquirrel({}), new MakerDMG({})],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
devContentSecurityPolicy: "connect-src 'self' * 'unsafe-eval'",
renderer: {
config: rendererConfig,
entryPoints: [
{
html: "./src/main/index.html",
js: "./src/main/renderer.ts",
name: "main_window",
preload: {
js: "./src/preload.ts",
},
},
],
},
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
repository: {
owner: "jamesg31",
name: "sonoron-radio-dispatch-ui",
},
prerelease: true,
},
},
],
};
export default config;
My Github Action in case that is useful:
# .github/workflows/release.yml
name: Release app
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-macos:
runs-on: macos-latest
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Add MacOS certs
run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- run: python3 -m pip install setuptools --break-system-packages
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Publish app
env:
DEBUG: electron-forge:*
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: npm run publish
build-windows:
runs-on: windows-latest
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Publish app
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: npx electron-forge publish
Additional information
Console with DEBUG=electron-forge:*
> [email protected] publish
> electron-forge publish
❯ Checking your system
2024-06-06T17:44:28.224Z electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this
❯ Checking git exists
❯ Checking node version
❯ Checking packageManager version
✔ Found node@20.[14](https://github.com/jamesg31/sonoron-radio-dispatch-ui/actions/runs/9405457525/job/25906659086#step:7:15).0
✔ Found [email protected]
✔ Found [email protected]
✔ Checking your system
2024-06-06T17:44:28.520Z electron-forge:project-resolver searching for project in: /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui
25h❯ Loading configuration
2024-06-06T[17](https://github.com/jamesg31/sonoron-radio-dispatch-ui/actions/runs/9405457525/job/25906659086#step:7:18):44:28.521Z electron-forge:project-resolver package.json with forge dependency found in /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/package.json
2024-06-06T17:44:30.002Z electron-forge:plugin:webpack hooking process events
✔ Loading configuration
❯ Resolving publish targets
2024-06-06T17:44:30.003Z electron-forge:require-search searching [
'@electron-forge/publisher-github',
'/Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/@electron-forge/publisher-github',
'/Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/node_modules/@electron-forge/publisher-github'
] relative to /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui
2024-06-06T17:44:30.004Z electron-forge:require-search testing @electron-forge/publisher-github
› Publishing to the following targets: github
✔ Resolving publish targets
❯ Running make command
2024-06-06T17:44:30.026Z electron-forge:publish triggering make
❯ Loading configuration
2024-06-06T17:44:30.026Z electron-forge:project-resolver searching for project in: /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui
2024-06-06T17:44:30.063Z electron-forge:project-resolver package.json with forge dependency found in /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/package.json
2024-06-06T17:44:30.090Z electron-forge:plugin:webpack hooking process events
✔ Loading configuration
2024-06-06T17:44:30.092Z electron-forge:project-resolver searching for project in: /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui
❯ Resolving make targets
2024-06-06T17:44:30.092Z electron-forge:project-resolver package.json with forge dependency found in /Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/package.json
› Making for the following targets:
2024-06-06T17:44:30.094Z electron-forge:plugin:webpack hooking process events
✔ Resolving make targets
❯ Running package command
❯ Preparing to package application
✔ Preparing to package application
❯ Running packaging hooks
❯ Running generateAssets hook
✔ Running generateAssets hook
❯ Running prePackage hook
❯ [plugin-webpack] Preparing webpack bundles
❯ Preparing native dependencies for arm64
✔ Preparing native dependencies
2024-06-06T17:44:30.362Z electron-forge:plugin:webpack:webpackconfig Config mode: production
❯ Building webpack bundles
✔ Building webpack bundles
2024-06-06T17:44:45.714Z electron-forge:packager packaging with options {
✔ [plugin-webpack] Preparing webpack bundles
asar: { unpack: '{{**/*.node,**/*.node},**/*.node}' },
✔ Running prePackage hook
overwrite: true,
✔ Running packaging hooks
ignore: [Function (anonymous)],
❯ Packaging application
icon: './src/assets/icon',
› Determining targets...
osxSign: { identity: 'Developer ID Application: ***' },
osxNotarize: {
appleId: '***',
appleIdPassword: '***',
teamId: '***'
},
quiet: true,
dir: '/Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui',
arch: 'arm64',
platform: 'darwin',
afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ],
afterComplete: [ [AsyncFunction (anonymous)] ],
afterCopy: [ [AsyncFunction (anonymous)] ],
afterExtract: [ [AsyncFunction (anonymous)] ],
afterPrune: [ [AsyncFunction (anonymous)] ],
out: '/Users/runner/work/sonoron-radio-dispatch-ui/sonoron-radio-dispatch-ui/out',
electronVersion: '30.0.6'
}
2024-06-06T17:44:45.7[18](https://github.com/jamesg31/sonoron-radio-dispatch-ui/actions/runs/9405457525/job/25906659086#step:7:19)Z electron-forge:packager targets: [ { platform: 'darwin', arch: 'arm64' } ]
❯ Packaging for arm64 on darwin
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
✔ Copying files
✔ Preparing native dependencies
Hi @jamesg31, if no additional debug information is provided, please try DEBUG=electron-*, which should also pull in debug logs from packager, notarize, and osx-sign :)
I run DEBUG=electron-* npm run make -- --arch="arm64" --platform="darwin"
and got this error
An unhandled rejection has occurred inside Forge: TypeError: Cannot read properties of null (reading 'toString') at flipFuses (/home/mohammad/projectFile/app/node_modules/@electron/fuses/src/index.ts:195:35) at async /home/mohammad/projectFile/app/node_modules/@electron-forge/plugin-fuses/src/FusesPlugin.ts:37:11 at async PluginInterface.triggerHook (/home/mohammad/projectFile/app/node_modules/@electron-forge/core/src/util/plugin-interface.ts:78:13) at async runHook (/home/mohammad/projectFile/app/node_modules/@electron-forge/core/src/util/hook.ts:29:3) at async getTargetKey.platform (/home/mohammad/projectFile/app/node_modules/@electron-forge/core/src/api/package.ts:243:17)
In my case, the step "Preparing native dependencies" hangs on notarytool process:
electron-notarize:spawn spawning cmd: xcrun args: [
'notarytool',
'submit',
'/var/folders/****.zip',
'--key',
'*********',
'--key-id',
'*********',
'--issuer',
'*********',
'--wait',
'--output-format',
'json'
] opts: {} +0ms
For the first time, it takes more than 7 hours. So github actions are not recommended for first publishing due to workflow minutes limit (or you are rich). The next build takes about 5 minutes
Sounds like an issue with Apple's notarization service, don't think this is something that's actionable on our end.
There is a description of the issue https://forums.developer.apple.com/forums/thread/739751
The best advice is to wait for it...