3
votes

I am unable to install react js using NPM. I am getting following error. Your environment has been set up for using Node.js 12.3.1 (ia32) and npm.

C:\Users\User>npm install create-react-app -g

npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE

npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE

npm ERR! request to https://registry.npmjs.org/create-react-app failed, reason:

unable to verify the first certificate

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

npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2019-12-14T05_54_58_7

16Z-debug.log

I am form India and I am not using any corporate firewall or VPN.

4
Check this answer, after However, stackoverflow.com/a/59515134/7692076 I don't know if this will resolve your problem, but try. - Akshit Mehra
Maybe check to ensure you opened a terminal "as administrator". I've run into node install issues when trying to install packages globally. (Though that usually fails for me with a different error) - Drew Reese
its certificate which is not valid. Try npm config set strict-ssl false - Mukund
Please set environment variables and then install npm globally - Govind Soni
@GovindSoni could you please elaborate on this. I am very new to NPM. That's why I have no idea what is environment variable. - user12050907

4 Answers

1
votes

hey can you try using npx create-react-app ${your project name}

1
votes

I ran the following command in the command line and worked for me:

npm config set strict-ssl false

Although it's not a great idea.

run this command to turn it on again:

npm config set strict-ssl true
0
votes

Download Node.js archive

After successfully installing NodeJS, we can start installing React upon it using npm. You can install ReactJS in two ways.

- Using webpack and babel.
- Using the create-react-app command.

But I am telling you about Using the create-react-app command:

- Instead of using webpack and babel you can install ReactJS more simply by installing create-react-app.

Browse through the desktop and install the Create React App using command prompt as shown below: 

Step 1: go to your specific directory and run below commands inside the folder like as below:
Step 2: d:\reactproject\>npx create-react-app my-app
Step 3: cd my-app
Step 4: npm start
0
votes

Check if your date is right. If it's not run this and try again:

sudo date --set="2015-09-30 10:05:59.990"