Reputation: 8203
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
Upvotes: 18
Views: 52521
Reputation: 1
Warning: Any solution that disables global security is a bad idea. You better be able to bet your career and home on this moment of "f'it".
So JUST DONT.
The previous respondents are correct,
npm config set registry https://registry.npmjs.org/
yarn config set registry https://registry.npmjs.org/
Additionally, having exported the NODE_OPTIONS environment variable...
export NODE_OPTIONS=--max-old_space_size=<memory limit>
It also aided in correcting the issue. This was for my Raspberry Pi 3 with Debian GNU/Linux 11
Upvotes: 0
Reputation: 67
After try the different options here (safest and unsafest) the problem persist. I solve that cleaning caches, specially Yarn; reboot & try again, and then voila, all works as is expected.
Upvotes: 0
Reputation: 1
Execute the following commands one by one to resolve the issue.
npm config set registry https://registry.npmjs.org/
npm config set "strict-ssl" false -g
npm config delete registry
Upvotes: 0
Reputation: 655
Not a big fan disabling strict-ssl.
This worked for me
yarn config set registry https://registry.npmjs.org
Upvotes: 14
Reputation: 1398
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
Upvotes: 55