Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE Phonegap Installation

我怕爱的太早我们不能终老 提交于 2019-11-27 11:32:51
jdmonty

I got the same error, given I was behind a corporate firewall/proxy and my connection was passed the proxy's certificate.

In your command line run:

npm config set strict-ssl false

NOTE: that this is not best practice to blindly accept untrusted or invalid SSL certificates, which is what the command does (turn off certificate checking). You can run

npm config set strict-ssl true

to turn it back on.

ref: https://thomashunter.name/blog/npm-ssl-errors/

Adam

This can be fixed without disabling strict SSL, however it is non-trivial.

Find the certificates actually being used, likely you're behind a corporate SSL intercepting proxy. You might be able to use a browser, some CLI tool etc. I ended up running certmgr.msc in Windows as the certificates are distributed via Group policy and export as p7b files.

Convert the certificates if necessary, I used openssl tool to convert from p7b to PEM (aka .crt)

openssl pkcs7 -print_certs -inform DER -in /mnt/adam/certs/my-company-root.p7b -outform PEM -out my-company-root.crt

Merge, if there is more than one certificate, into a single PEM file, taking care to order from leaf to root.

cat my-company-leaf.crt my-company-intermediate.crt my-company-root.crt > my-company-single.crt

Configure npm at the certificate file

npm config set cafile my-company-single.crt

(or globally)

sudo npm config set -g cafile my-company-single.crt

running

npm config set strict-ssl false

solved my problem.

I'm using Vagrant (Linux precise32 Ubuntu ), and Windows 7 as host.

Thanks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!