`electron-builder` 在 mac 中因代码签名错误而失败

问题描述 投票:0回答:1

我有一个简单的构建脚本来构建/打包

electron
应用程序。
electron-builder
失败,堆栈跟踪如下。

/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`

这是

build
 中的 
package.json

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

直到我拒绝访问我的钥匙串才发生这种情况,之后它开始抛出错误。有想法摆脱这个吗?

electron digital-signature electron-builder dmg code-signing-entitlements
1个回答
3
投票

作为临时解决方案,您可以在运行

export CSC_IDENTITY_AUTO_DISCOVERY=false
脚本之前运行
npm run pack
。它将执行的操作是禁用电子构建器自动从您的钥匙串中获取签名证书。但是,您将从构建器处获得此信息:
skipped macOS application code signing  reason=, see https://electron.build/code-signing CSC_IDENTITY_AUTO_DISCOVERY=false
但您仍然可以在构建后运行和测试应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.