I happened to encounter this similar SSL problem a few days ago. The problem is your npm does not set root certificate for the certificate used by https://registry.npmjs.org.
Solutions:
wget https://registry.npmjs.org/coffee-script --ca-certificate=./DigiCertHighAssuranceEVRootCA.crt
to fix wget problemnpm config set cafile /path/to/DigiCertHighAssuranceEVRootCA.crt
to set root certificate for your npm program.you can download root certificate from : https://www.digicert.com/CACerts/DigiCertHighAssuranceEVRootCA.crt
Notice: Different program may use different way of managing root certificate, so do not mix browser's with others.
let's fix your wget https://registry.npmjs.org/coffee-script
problem first. your snippet says:
ERROR: cannot verify registry.npmjs.org's certificate, issued by /C=US/ST=CA/L=Oakland/O=npm/OU=npm Certificate Authority/CN=npmCA/[email protected]: Unable to locally verify the issuer's authority.
This means that your wget program cannot verify https://registry.npmjs.org
's certificate. There are two reasons that may cause this problem:
So the solution is explicitly set root certificate for https://registry.npmjs.org
. We can use openssl to make sure that the reason bellow is the problem.
Try openssl s_client -host registry.npmjs.org -port 443
on the command line and we will get this message (first several lines):
CONNECTED(00000003) depth=1 /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3 verify error:num=20:unable to get local issuer certificate verify return:0 --- Certificate chain 0 s:/C=US/ST=California/L=San Francisco/O=Fastly, Inc./CN=a.sni.fastly.net i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3 1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3 i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA ---
This line verify error:num=20:unable to get local issuer certificate
makes sure that https://registry.npmjs.org
does not pack root certificate. So we Google DigiCert High Assurance EV Root CA
root Certificate.