Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

request to https://registry.npmjs.org/co failed

If I do npm install in my repository. I get the below error

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/co failed, reason: unable to get local issuer certificate

I tried with

npm config set registry https://registry.npmjs.org/

But it does not solve the problem

Please help to resolve this issue. Thanks in advance!

like image 473
Thangakumar D Avatar asked Feb 09 '19 23:02

Thangakumar D


4 Answers

This appears to be an issue with attempting to use SSL while installing your project's required packages. This occurs due to how you set your npm registry:

npm config set registry https://registry.npmjs.org/

Notice the https prefix in your npm registry, Hyper Text Transfer Protocol Secure (HTTPS) is the secure version of HTTP, the protocol over which data is sent between your browser and the website that you are connected to. The 'S' at the end of HTTPS stands for 'Secure'. It means all communications between your browser and the website are encrypted. HTTPS pages typically use one of two secure protocols to encrypt communications - SSL (Secure Sockets Layer) or TLS (Transport Layer Security).

Perhaps you can try the following to see if it resolves your issue:

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

Then try reinstalling your dependencies with an npm install

Alternatively, you can turn off the ssl requirement (although use at your own discretion) by doing the following:

npm config set strict-ssl false

then try to install your requirements again with an npm install

like image 197
Nathan Avatar answered Oct 31 '22 07:10

Nathan


I just had the same issue (just learning NodeJS for the first time). Turned out that I had a ZScaler issue. I disabled it for the download and it worked.

like image 36
Dave Girvitz Avatar answered Oct 31 '22 06:10

Dave Girvitz


Removing package-lock.json file (and restarting build) solved this issue for me.

like image 29
mks Avatar answered Oct 31 '22 07:10

mks


This is probably due to a proxy network. You can disable the proxy and run npm install
Or make sure you set the proxy configurations

npm config set https-proxy [address]:[port]

Then try npm install again

like image 40
Obed Amoako Avatar answered Oct 31 '22 06:10

Obed Amoako