我正在构建一个 Electron 应用,并使用 npm 包 electron-builder 来为 Windows 构建应用和安装程序。我正在尝试使用
这行代码是在electron-builder的
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.request(...)
https://github.com/electron-userland/electron-builder/blob/master/src/httpRequest.ts#L28。这让我认为Windows机器或证书存在问题。我正在运行Windows 10,node 5.9.0。