Cannot run example on mac
glenne opened this issue · comments
When running the default app on maos, it fails with an error.
Prerequisites
- [X ] Using npm
- [X ] Using an up-to-date
main
branch - [X ] Using latest version of devtools. Check the docs for how to update
- [ X] Tried solutions mentioned in #400
- [ X] For issue in production release, add devtools output of
DEBUG_PROD=true npm run build && npm start
Expected Behavior
After npm run package
I should be able to run the resulting build.
Current Behavior
I can use npm start
successfully but after npm run package
the resulting .dmg or .app builds generate an error.
Steps to Reproduce
# git clone the repo
npm install
npm start # verify it works
npm run package
> package
> ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never && npm run build:dll
> build
> concurrently "npm run build:main" "npm run build:renderer"
[1]
[1] > build:renderer
[1] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts
[1]
[0]
[0] > build:main
[0] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts
[0]
[1] npm run build:renderer exited with code 0
[0] npm run build:main exited with code 0
• electron-builder version=24.6.4 os=22.1.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=release/build/builder-effective-config.yaml
• installing production dependencies platform=darwin arch=arm64 appDir=/Users/glenne/gitjunk/test-electron-react-boilerplate/release/app
• packaging platform=darwin arch=arm64 electron=26.2.1 appOutDir=release/build/mac-arm64
• signing file=release/build/mac-arm64/ElectronReact.app identityName=Apple Configurator 2: Glenn Engel (<snip>) identityHash=<snip> provisioningProfile=none
Skipping notarizing step. Packaging is not running in CI
• building target=macOS zip arch=arm64 file=release/build/ElectronReact-4.6.0-arm64-mac.zip
• building target=DMG arch=arm64 file=release/build/ElectronReact-4.6.0-arm64.dmg
• installing production dependencies platform=darwin arch=x64 appDir=/Users/glenne/gitjunk/test-electron-react-boilerplate/release/app
• packaging platform=darwin arch=x64 electron=26.2.1 appOutDir=release/build/mac
• signing file=release/build/mac/ElectronReact.app identityName=Apple Configurator 2: Glenn Engel (<snip>) identityHash=<snip> provisioningProfile=none
• building block map blockMapFile=release/build/ElectronReact-4.6.0-arm64.dmg.blockmap
• building block map blockMapFile=release/build/ElectronReact-4.6.0-arm64-mac.zip.blockmap
Skipping notarizing step. Packaging is not running in CI
• building target=macOS zip arch=x64 file=release/build/ElectronReact-4.6.0-mac.zip
• building target=DMG arch=x64 file=release/build/ElectronReact-4.6.0.dmg
• building block map blockMapFile=release/build/ElectronReact-4.6.0.dmg.blockmap
• building block map blockMapFile=release/build/ElectronReact-4.6.0-mac.zip.blockmap
> build:dll
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts
-
Run the .dmg installer
-
Run the app
App fails to run with this error
/Applications/ElectronReact.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
Full report:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/Electron Framework.framework/Electron Framework
Referenced from: <4C4C44E2-5555-3144-A1CB-96CDFAC879DC> /Applications/ElectronReact.app/Contents/MacOS/ElectronReact
Reason: tried: '/Applications/ElectronReact.app/Contents/Frameworks/Electron Framework.framework/Electron Framework' (code signature in <4C4C44CD-5555-3144-A163-C31E72A052F7> '/Applications/ElectronReact.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/ElectronReact.app/Contents/Frameworks/Electron Framework.framework/Electron Framework' (code signature in <4C4C44CD-5555-3144-A163-C31E72A052F7> '/Applications/ElectronReact.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/System/V
(terminated at launch; ignore backtrace)
Your Environment
- Node version : v16.13.0
- electron-react-boilerplate version or branch : latest main (Sept 16, 2023)
- Operating System and version : Macos Ventura 13.0
For anyone else getting here, the problem was the type of certificate needed for signing. I had an 'Apple Developer' certificate in my keychain but not a 'Developer ID' certificate. Once I added the proper certificate the build ran fine.
When creating this certificate, select the last option in the list - Developer ID Application. Download it and add it to your keychain. When signing, you'll see a log entry like the following:
• signing file=release/build/mac/ElectronReact.app identityName=Developer ID Application: TEAM NAME (TEAM_ID) identityHash=<snip> provisioningProfile=none