self signed certificate in certificate chain

> node-nightly --inspect --debug-brk build/build.js

Downloading the nightly version, hang on...
FetchError: request to https://nodejs.org/download/nightly/index.json failed, reason: self signed certificate in certificate chain
at ClientRequest.<anonymous> (C:\Users\clu\AppData\Roaming\npm\node_modules\node-nightly\node_modules\node-fetch\index.js:133:11)
at ClientRequest.emit (events.js:310:20)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:310:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
type: 'system',
errno: 'SELF_SIGNED_CERT_IN_CHAIN',
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}

self signed certificate in certificate chain

If you're behind the corporate proxy (which uses e.g. Blue Coat), you should use http instead of https for repository addresses, e.g.

npm config set registry="http://registry.npmjs.org/"

See: Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm.


You can also import failing self-certificate into your system and mark as trusted, or temporary disable SSL validation while installing packages (quick, but not recommended method):

npm config set strict-ssl false

See: Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN while using npm.


The recommended way (and more painful) is just to point to the right certificate file, e.g.

npm config set cafile "<path to your certificate file>"

See: How to fix SSL certificate error when running Npm on Windows?.

前面两个方法都是无效的,只能尝试导入证书

Fix Git Self Signed Certificate in Certificate Chain on Windows

 通过命令git config --list --show-origin找到git证书的位置

C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

Using your favorite text editor you can open up your ca-bundle.crt file that you copied & your .cer files you exported from the browser. Copy the entire .cer text including the ----BEGIN CERTIFICATE--- and ----END CERTIFICATE--- to the bottom of your ca-bundle.crt file. Do this for all the .cer files you exported.

1.复制一份git的证书

2.然后把导出的node.js的证书,复制到git的证书下面(直接用notepad++操作)

3.配置npm证书

npm config set cafile 'C:\Users\clu\chuck-ca-bundle.crt'

猜你喜欢

转载自www.cnblogs.com/chucklu/p/12915555.html