0

I tried reinstalling yarn, npm,

Tried npm cache clean and yarn cache clean.

Still facing the same problem while npx create-react-app my-app

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: self signed certificate in certificate chain".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\suryanarayan.rath\\DMS-cloud\\resilient-app\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd C:\Users\suryanarayan.rath\DMS-cloud\resilient-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

In yarn-error.log it shows following

Error: self signed certificate in certificate chain
      at TLSSocket.onConnectSecure (_tls_wrap.js:1502:34)
      at TLSSocket.emit (events.js:314:20)
      at TLSSocket._finishInit (_tls_wrap.js:937:8)
      at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:711:12)

I saw many similar questions which were posted earlier but could not find the right solution.

emi
  • 2,786
  • 1
  • 16
  • 24

1 Answers1

0

I am able to resolve the issue by

yarn config set "strict-ssl" false -g

or

npm config set "strict-ssl" false -g

Setting the strict-ssl to false resolved my issue.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • 1
    This does not solves the issue, but makes it worse by using an insecure procedure (any man-in-the-middle will be able to install malware in your project) and habituates the users to do so (instead of solving the real problem in their "Operating System"). – emi Mar 08 '21 at 19:51