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

If I run npm install in my repository, I encounter the following 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

Solution

It seems that the issue you’re encountering is related to using SSL while installing your project’s required packages. This might be due to the way you’ve set your npm registry. When you use npm config set registry https://registry.npmjs.org/, you’re specifying an HTTPS registry, which requires a secure connection.

To resolve this issue, you can try the following:

  1. Switch to HTTP Registry: Change your npm registry to use HTTP instead of HTTPS:
   npm config set registry http://registry.npmjs.org/

Then try reinstalling your dependencies with npm install.

  1. Disable SSL Requirement: If you prefer to keep using HTTPS but want to disable the SSL requirement, you can do the following:
   npm config set strict-ssl false

Then try installing your requirements again with npm install.

Choose the option that best fits your needs and security requirements.

Leave a Comment