Search code examples
electronsigningelectron-builderdmgcode-signing-entitlements

`electron-builder` failed with code signing error in mac


I have a simple build script to build/package theelectron application. The electron-builder fails with the stack trace given below.

/Users/vkiranmaniya/Projects/Electron/GSTPro/node_modules/app-builder-lib/templates/entitlements.mac.plist 
/Users/vkiranmaniya/Projects/Electron/GSTPro/dist/mac/GSTPro.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          /Users/vkiranmaniya/Projects/Electron/GSTPro/dist/mac/GSTPro.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework: errSecInternalComponent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          at ChildProcess.exithandler (child_process.js:294:12)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             at ChildProcess.emit (events.js:198:13)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             at maybeClose (internal/child_process.js:982:16)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at Socket.stream.socket.on (internal/child_process.js:389:11)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           at Socket.emit (events.js:198:13)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     at Pipe._handle.close (net.js:606:12)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             From previous event:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             at module.exports.execFileAsync (/Users/vkiranmaniya/Projects/Electron/GSTPro/node_modules/app-builder-lib/electron-osx-sign/util.js:41:10)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              at /Users/vkiranmaniya/Projects/Electron/GSTPro/node_modules/app-builder-lib/electron-osx-sign/sign.js:172:17                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          From previous event:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            at signApplicationAsync (/Users/vkiranmaniya/Projects/Electron/GSTPro/node_modules/app-builder-lib/electron-osx-sign/sign.js:127:6)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              at /Users/vkiranmaniya/Projects/Electron/GSTPro/node_modules/app-builder-lib/electron-osx-sign/sign.js:338:14                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] pack: electron-builder --dir
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] pack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vkiranmaniya/.npm/_logs/2019-08-21T18_22_24_504Z- debug.log`

Here is the build config in package.json

"build": {
    "appId": "com.trinityinfosystem.gstpro",
    "productName": "GSTPro",
    "copyright": "Copyright © 2018"
}

It was not happening until i refuses to access my keychain, after that it started throwing error. Any idea to get out of the rid?


Solution

  • As a temporary solution you can run export CSC_IDENTITY_AUTO_DISCOVERY=false before running npm run pack script. What it will do is disable the electron-builder to automatically fetch the signing certificate from your keychain. However, you will get this info from builder as skipped macOS application code signing reason=, see https://electron.build/code-signing CSC_IDENTITY_AUTO_DISCOVERY=false but still you will be able to run and test application after build.