I\'m trying to install Phonegap in Ubuntu. The installation of NodeJS was successful, however I can\'t install Phonegap itself. Here is the error output of terminal:
You can also disable SSL check in your code using node environment variable :
in your index.js file, add :
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
Note that this is not a good habits as it will not try to check the validity of https certificate
running
npm config set strict-ssl false
solved my problem.
I'm using Vagrant (Linux precise32 Ubuntu ), and Windows 7 as host.
Thanks
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/
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
in case anyone is as clumsy as me, I got UNABLE_TO_VERIFY_LEAF_SIGNATURE
on npm install
when I forgot to add the git+
before the url of my project.
I had
npm install --save https://myserv.er/my/project-path.git
instead of
npm install --save git+https://myserv.er/my/project-path.git