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.66k stars 1.74k forks source link

"Unable to build chain to self-signed root for signer" on macOS 11.2.2! help! #5684

Closed quinton-ashley closed 3 years ago

quinton-ashley commented 3 years ago
nostlan % sudo electron-builder -m
  • electron-builder  version=22.10.5 os=20.3.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=robotjs@0.6.0, sharp@0.27.1, usb@1.6.4 platform=darwin arch=x64
  • install prebuilt binary  name=sharp version=0.27.1 platform=darwin arch=x64
  • install prebuilt binary  name=robotjs version=0.6.0 platform=darwin arch=x64
  • build native dependency from sources  name=robotjs
                                          version=0.6.0
                                          platform=darwin
                                          arch=x64
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=prebuild-install info begin Prebuild-install version 5.3.6
    prebuild-install WARN install prebuilt binaries enforced with --force!
    prebuild-install WARN install prebuilt binaries may be out of date!
    prebuild-install info looking for cached prebuild @ /Users/qashto/.npm/_prebuilds/e64806-robotjs-v0.6.0-electron-v85-darwin-x64.tar.gz
    prebuild-install http request GET https://github.com/octalmage/robotjs/releases/download/v0.6.0/robotjs-v0.6.0-electron-v85-darwin-x64.tar.gz
    prebuild-install http 404 https://github.com/octalmage/robotjs/releases/download/v0.6.0/robotjs-v0.6.0-electron-v85-darwin-x64.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=11.2.3 runtime=electron arch=x64 libc= platform=darwin)

  • install prebuilt binary  name=usb version=1.6.4 platform=darwin arch=x64
  • build native dependency from sources  name=sharp
                                          version=0.27.1
                                          platform=darwin
                                          arch=x64
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=prebuild-install info begin Prebuild-install version 5.3.6
    prebuild-install WARN install prebuilt binaries enforced with --force!
    prebuild-install WARN install prebuilt binaries may be out of date!
    prebuild-install info looking for cached prebuild @ /Users/qashto/.npm/_prebuilds/d19ae8-sharp-v0.27.1-electron-v85-darwin-x64.tar.gz
    prebuild-install http request GET https://github.com/lovell/sharp/releases/download/v0.27.1/sharp-v0.27.1-electron-v85-darwin-x64.tar.gz
    prebuild-install http 404 https://github.com/lovell/sharp/releases/download/v0.27.1/sharp-v0.27.1-electron-v85-darwin-x64.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=11.2.3 runtime=electron arch=x64 libc= platform=darwin)

  • build native dependency from sources  name=usb
                                          version=1.6.4
                                          platform=darwin
                                          arch=x64
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=prebuild-install info begin Prebuild-install version 5.3.6
    prebuild-install WARN install prebuilt binaries enforced with --force!
    prebuild-install WARN install prebuilt binaries may be out of date!
    prebuild-install info looking for cached prebuild @ /Users/qashto/.npm/_prebuilds/f6cf1d-usb-v1.6.4-electron-v85-darwin-x64.tar.gz
    prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.4/usb-v1.6.4-electron-v85-darwin-x64.tar.gz
    prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.4/usb-v1.6.4-electron-v85-darwin-x64.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=11.2.3 runtime=electron arch=x64 libc= platform=darwin)

  • packaging       platform=darwin arch=x64 electron=11.2.3 appOutDir=dist/mac
  • Unpacking electron zip  zipPath=undefined
  • signing         file=dist/mac/nostlan.app identityName=Apple Development: qashto@gmail.com (REDACTED) identityHash=[REDACTED] provisioningProfile=none
  ⨯ Command failed: codesign --sign REDACTED --force --timestamp --options runtime --entitlements /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/templates/entitlements.mac.plist /Users/qashto/dev/apps/nostlan/dist/mac/nostlan.app/Contents/Resources/app.asar.unpacked/node_modules/sharp/vendor/8.10.5/lib/libvips-cpp.42.dylib
Warning: unable to build chain to self-signed root for signer "Apple Development: qashto@gmail.com (REDACTED)"
/Users/qashto/dev/apps/nostlan/dist/mac/nostlan.app/Contents/Resources/app.asar.unpacked/node_modules/sharp/vendor/8.10.5/lib/libvips-cpp.42.dylib: errSecInternalComponent
stackTrace=

Error: Command failed: codesign --sign REDACTED --force --timestamp --options runtime --entitlements /usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/templates/entitlements.mac.plist /Users/qashto/dev/apps/nostlan/dist/mac/nostlan.app/Contents/Resources/app.asar.unpacked/node_modules/sharp/vendor/8.10.5/lib/libvips-cpp.42.dylib

Warning: unable to build chain to self-signed root for signer "Apple Development: qashto@gmail.com (READACTED)"

/Users/qashto/dev/apps/nostlan/dist/mac/nostlan.app/Contents/Resources/app.asar.unpacked/node_modules/sharp/vendor/8.10.5/lib/libvips-cpp.42.dylib: errSecInternalComponent

at ChildProcess.exithandler (node:child_process:326:12)
at ChildProcess.emit (node:events:378:20)
at maybeClose (node:internal/child_process:1067:16)
at Socket.<anonymous> (node:internal/child_process:453:11)
at Socket.emit (node:events:378:20)
at Pipe.<anonymous> (node:net:665:12)

From previous event:
at processImmediate (node:internal/timers:464:21)

From previous event:

at MacPackager.signApp (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/macPackager.ts:392:27)
at MacPackager.doSignAfterPack (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/platformPackager.ts:270:16)
at MacPackager.doPack (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/platformPackager.ts:255:7)
at MacPackager.pack (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/macPackager.ts:167:7)
at Packager.doBuild (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:434:9)
at executeFinally (/usr/local/lib/node_modules/electron-builder/node_modules/builder-util/src/promise.ts:12:14)
at Packager._build (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:369:31)
at Packager.build (/usr/local/lib/node_modules/electron-builder/node_modules/app-builder-lib/src/packager.ts:333:12)
at executeFinally (/usr/local/lib/node_modules/electron-builder/node_modules/builder-util/src/promise.ts:12:14)
quinton-ashley commented 3 years ago

I think the problem is that my folder permisions got messed up. Fixed with chmod 777 -R ./

quinton-ashley commented 3 years ago

no that didn't fix it actually

Mr777Nick commented 3 years ago

Try to move the folder into desktop or any other non-admin folder. Then run the command without using sudo.

quinton-ashley commented 3 years ago

I forgot to update this issue request. I got it to work but the zip created by electron-builder was bad, the uncompressed app from the zip didn't have signing. I had to zip the app myself and then it would be signed properly.

mmaietta commented 3 years ago

Seems like your env may need to be reconfigured with new Certificate Authority certs https://developer.apple.com/forums/thread/131088?answerId=620963022#620963022

Is zip your only target by chance?

quinton-ashley commented 3 years ago

I think I fixed the certificate issues before.

Should I use a different target?

mmaietta commented 3 years ago

Can you please try using dmg and see if the app inside it is signed properly?

I think you may be running into a bug with the mac target that was mentioned in some old issue, but I'll need you to try the dmg target instead of zip to confirm.

quinton-ashley commented 3 years ago

okay I will soon, sorry I did not respond to this sooner

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

SongAdonis commented 3 years ago

I forgot to update this issue request. I got it to work but the zip created by electron-builder was bad, the uncompressed app from the zip didn't have signing. I had to zip the app myself and then it would be signed properly.

I have same issues . What did you do to fix it?

careteenL commented 2 years ago

@quinton-ashley I have same issues . What did you do to fix it?

quinton-ashley commented 2 years ago

Update to the latest version of electron and electron-builder.

On Thu, Dec 9, 2021 at 01:50 Careteen @.***> wrote:

@quinton-ashley https://github.com/quinton-ashley I have same issues . What did you do to fix it?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-builder/issues/5684#issuecomment-989564690, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEY2RQ6ZYXLDVV7N4LKK5KTUQBGRVANCNFSM4YXEPIPQ .

arnaudambro commented 1 year ago

Spent 4-5 hours on it yesterday

I solved it by creating the certificates directly from XCode, not from developer.apple.com

What an nightmare...

hijack401 commented 11 months ago

Spent 4-5 hours on it yesterday

I solved it by creating the certificates directly from XCode, not from developer.apple.com

What an nightmare...

I can confirm, this worked for me as well!

Previously I just created the certificate on the Apple Developer Dashboard, and downloaded it. Then I opened it and set it to "Trust always", however this is apparently not correct.

When I generated the certificate with Xcode, I get right away get a green check, saying the certificate is trusted. That's what you need! CleanShot 2023-12-06 at 00 22 20@2x

It's easy to generate the certificate via Xcode

  1. Open Xcode
  2. Go to Settings > Accounts
  3. Add your account (use the account which is associated with your Apple Developer Account)
  4. Click "Manage Certificates..."
  5. Hit "+" in the left corner below
  6. Select "Developer ID Application"
bugfix43 commented 9 months ago

Thanks a lot guys!!! Xcode Certificats finally fixed the same issue for me:)

Tej-Sharma commented 4 months ago

I did all 3 before it worked:

  1. Deleted all certificates that seemed Apple signing related
  2. Created Apple Development certification in the above XCode generation steps for the organization instead of personal
  3. Ran without sudo

It seems running with sudo makes it fail, just tried with / without and that seems to be a direct cause... not sure how though and a bit curious