An unexpected error occurred: "https://registry.yarnpkg.com/react: unable to get local issuer certificate" while create-react-app

Viewed 20644

I have the following installed on my windows machine:

Node : v12.18.4

yarn : 1.19.1

create-react-app: 3.4.1

I navigated to the folder c:\temp and then tried to create react app using the following command:

c:\temp>create-react-app react-test --scripts-version 1.1.5

On executing the above command I see the following error:

Creating a new React app in C:\Temp\react-test.

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

yarn add v1.19.1
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: unable to get local issuer certificate".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Temp\\react-test\\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:\Temp\react-test has failed.

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

Can anyone help me here by providing their guidance to fix this issue

2 Answers

Turn off the strict-ssl on yarn/npm config, and try again

yarn config set "strict-ssl" false -g

or

npm config set "strict-ssl" false -g

Not a big fan disabling strict-ssl.

This worked for me

yarn config set registry https://registry.npmjs.org
Related