npm install fail : unable to get local issuer certificate

When doing the npm install, we got error below.

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

 

Solution 1

$ npm config set strict-ssl false

Now we can do the install, however, there are some warning message below.

PS C:\source\repos\WebApplication1> npm install -g bower
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_GET_ISSUER_CERT_LO
CALLY: request to https://registry.npmjs.org/bower failed, reason: unable to get local issuer certificate
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.

Solution 2

PS C:\source\repos\WebApplication1> npm install -g bower
C:\Users\grayyin\AppData\Roaming\npm\bower -> C:\Users\grayyin\AppData\Roaming\npm\node_modules\bower\bin\bower
+ bower@1.8.12
added 1 package from 1 contributor in 38.139s

Looks fine.