Tuesday, 3 August 2021

React - npm : self signed certificate in certificate chain issue

 When I try to install react-router using "npm install react-router-dom"

I got below mentioned error message

PS C:\PracticeApps\React\my-react-app> npm install react-router-dom

npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN: request to https://registry.npmjs.org/react-router-dom failed, reason: self signed certificate in certificate chain

npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.

npm ERR! code SELF_SIGNED_CERT_IN_CHAIN

npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN

npm ERR! request to https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz failed, reason: self signed certificate in certificate chain  


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\KMATADA\AppData\Roaming\npm-cache\_logs\2021-08-03T14_08_06_664Z-debug.log


Solution : Try to run below commands

1.  npm install npm -g --ca=""


2. npm config set strict-ssl false   ( not recommended - ignoring ssl error is bad idea)



Reference Link

https://stackoverflow.com/questions/9626990/receiving-error-error-ssl-error-self-signed-cert-in-chain-while-using-npm