我正在构建一个 Electron 应用程序并使用 npm 包 electron-builder 来构建适用于 Windows 的应用程序和安装程序。我正在尝试使用CSC_LINK
和CSC_KEY_PASSWORD
环境变量来签署应用程序,如下所述:https ://github.com/electron-userland/electron-builder#travis-appveyor-and-other-ci-servers
第一次尝试错误和堆栈跟踪是:
Unhandled rejection Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1065:38)
at emitNone (events.js:80:13)
at TLSSocket.emit (events.js:179:7)
at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:593:8)
at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:425:38)
From previous event:
at Object.downloadCertificate (C:\projects\presentation\Electron\node_modules\electron-builder\src\codeSign.ts:97:18)
...
然后我尝试设置环境变量NODE_TLS_REJECT_UNAUTHORIZED=0
,现在得到一个不同的错误:
Unhandled rejection Error: Request error, status 400: Bad Request
at ClientRequest.<anonymous> (C:\projects\presentation\Electron\node_modules\electron-builder\src\httpRequest.ts:36:16)
...
在 electron-builder 中调用的特定行httpRequest.ts
似乎只是使用 Node 的 https 模块:https: https.request(...)
//github.com/electron-userland/electron-builder/blob/master/src/httpRequest.ts#L28
这让我相信 Windows 机器或证书有问题。我在 Windows 10 节点 5.9.0 上运行它。