5

我正在构建一个 Electron 应用程序并使用 npm 包 electron-builder 来构建适用于 Windows 的应用程序和安装程序。我正在尝试使用CSC_LINKCSC_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 上运行它。

4

2 回答 2

1

最好直接将问题提交到https://github.com/electron-userland/electron-builder/issues以获得维护人员的答复。我是活跃的当前维护者,不检查 SO,所以,你不太可能很快得到答案;)

如果问题对您来说仍然是实际的,请提交问题:)

于 2016-04-04T07:35:17.103 回答
1

不确定问题的根源是什么,但是我能够通过将文件移动到 Dropbox 来让一切正常工作。我仍然必须设置NODE_TLS_REJECT_UNAUTHORIZED=0并且CSC_LINK需要设置不带引号:

成功: SET CSC_LINK=https://www.dropbox.com/s/path/to/file.p12?dl=1

失败的: SET CSC_LINK="https://www.dropbox.com/s/path/to/file.p12?dl=1"

可以在此处找到有关 electron-builder GitHub 问题讨论的链接:https ://github.com/electron-userland/electron-builder/issues/291

于 2016-04-06T23:44:05.147 回答