electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.68k stars 1.74k forks source link

code has no resources but signature indicates they must be present #8419

Closed devonkinghorn closed 2 months ago

devonkinghorn commented 2 months ago

I couldn't get my electron app to notarize which is based on electron-react-boilerplate. I keep getting an error. I tried to use the latest master without my app and it still doesn't work

Steps to Reproduce

  1. get certificates from xcode
  2. clone fresh repo && npm i
  3. change package.json build.mac.notarize to true
  4. run npm run package

Instead of building the app. I get the error ElectronReact.app: code has no resources but signature indicates they must be present

full stack trace of the error


> 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"

[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] 
[1] > build:renderer
[1] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts
[1] 
[1] npm run build:renderer exited with code 0
[0] npm run build:main exited with code 0
  • electron-builder  version=24.13.3 os=23.0.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/myusername/dev/electron-react-boilerplate/release/app
  • packaging       platform=darwin arch=arm64 electron=26.6.10 appOutDir=release/build/mac-arm64
  • map async       taskCount=2
  • map async       taskCount=1
  • map async       taskCount=255
  • map async       taskCount=8
  • path resolved   path=/Users/myusername/dev/electron-react-boilerplate/assets/icon.icns outputFormat=icns
  • map async       taskCount=5
  • executing custom sign  file=release/build/mac-arm64/ElectronReact.app platform=darwin type=distribution identity=EBF410A181256E3C800D3FE16C65BBB4D2AD9D4D provisioningProfile=none
  electron-notarize attempting to check codesign of app: /Users/myusername/dev/electron-react-boilerplate/release/build/mac-arm64/ElectronReact.app +0ms
  electron-notarize:spawn spawning cmd: codesign args: [ '-vvv', '--deep', '--strict', 'ElectronReact.app' ] opts: {
  cwd: '/Users/myusername/dev/electron-react-boilerplate/release/build/mac-arm64'
} +0ms
  electron-notarize:spawn spawning cmd: codesign args: [ '-dv', '-vvvv', '--deep', 'ElectronReact.app' ] opts: {
  cwd: '/Users/myusername/dev/electron-react-boilerplate/release/build/mac-arm64'
} +3ms
  electron-notarize:spawn cmd codesign terminated with code: 0 +5ms
  electron-notarize:spawn cmd codesign terminated with code: 1 +7ms
  electron-notarize codesign check failed +16ms
  ⨯ Failed to codesign your application with code: 1

ElectronReact.app: code has no resources but signature indicates they must be present

Executable=/Users/myusername/dev/electron-react-boilerplate/release/build/mac-arm64/ElectronReact.app/Contents/MacOS/ElectronReact
Identifier=Electron
Format=app bundle with Mach-O thin (arm64)
CodeDirectory v=20400 size=513 flags=0x20002(adhoc,linker-signed) hashes=13+0 location=embedded
VersionPlatform=1
VersionMin=720896
VersionSDK=852736
Hash type=sha256 size=32
CandidateCDHash sha256=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7e
CandidateCDHashFull sha256=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7efd8ab582057679f37d399361
Hash choices=sha256
CMSDigest=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7efd8ab582057679f37d399361
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=16384
Executable Segment flags=0x1
Page size=4096
CDHash=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7e
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements=none
  failedTask=build stackTrace=Error: Failed to codesign your application with code: 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ElectronReact.app: code has no resources but signature indicates they must be present
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Executable=/Users/myusername/dev/electron-react-boilerplate/release/build/mac-arm64/ElectronReact.app/Contents/MacOS/ElectronReact
Identifier=Electron
Format=app bundle with Mach-O thin (arm64)
CodeDirectory v=20400 size=513 flags=0x20002(adhoc,linker-signed) hashes=13+0 location=embedded
VersionPlatform=1
VersionMin=720896
VersionSDK=852736
Hash type=sha256 size=32
CandidateCDHash sha256=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7e
CandidateCDHashFull sha256=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7efd8ab582057679f37d399361
Hash choices=sha256
CMSDigest=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7efd8ab582057679f37d399361
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=16384
Executable Segment flags=0x1
Page size=4096
CDHash=e17bbbb3cd0677a7f7e747ab1da810c4e7b39b7e
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements=none
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       at /Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/node_modules/@electron/notarize/src/check-signature.ts:41:11
    at Generator.next (<anonymous>)
    at fulfilled (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/node_modules/@electron/notarize/lib/check-signature.js:28:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
From previous event:
    at processImmediate (node:internal/timers:478:21)
From previous event:
    at readDirectoryAndSign (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/macPackager.ts:478:29)
    at MacPackager.signApp (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/macPackager.ts:488:11)
    at MacPackager.doSignAfterPack (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/platformPackager.ts:336:21)
    at MacPackager.doPack (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/platformPackager.ts:321:7)
    at MacPackager.pack (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/macPackager.ts:198:9)
    at Packager.doBuild (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/packager.ts:445:9)
    at executeFinally (/Users/myusername/dev/electron-react-boilerplate/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/packager.ts:379:31)
    at Packager.build (/Users/myusername/dev/electron-react-boilerplate/node_modules/app-builder-lib/src/packager.ts:340:12)
    at executeFinally (/Users/myusername/dev/electron-react-boilerplate/node_modules/builder-util/src/promise.ts:12:14)

Here are my identities. I had more, but I deleted them and recreated them just to try to debug

  1) numbers1 "Apple Development: Devon Kinghorn (id1)"
  2) numbers2 "Apple Distribution: Devon Kinghorn (id2)"
     2 valid identities found
mmaietta commented 2 months ago

executing custom sign in the logs means it has overridden the default signing mechanism. Is there something else in your project configuration for mac.sign?

devonkinghorn commented 2 months ago

https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/main/package.json#L183 Yes it's using this line. Should I just remove that option and it will just use system defaults with env variables?

devonkinghorn commented 2 months ago

I removed it and things are looking much better. Everything works. Thanks.

I'll let the electron-react-boilerplate maintainers know about this.

For whoever comes. I also had to add teamId to build.mac.notarize

"build: {
...
   "mac": {
      "notarize": {
        "teamId": "xxx"
      },
...