I get 'react-native' is not recognized as an internal or external command when I run "npx react-native init AwesomeProject"

Viewed 2858

I have installed node and jdk8 using chocolaty.

While I was following the official guide "Setting up the development environment -> React Native ClI Quick start for 'Windows & Android'" I get the following error when I run npx react-native init AwesomeProject command:

'react-native' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path E:\UOG\React_Native_Projects\MyFirstApp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c react-native init AwesomeProject

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Muhammad Suleman\AppData\Local\npm-cache\_logs\2021-01-23T09_10_07_360Z-debug.log
2 Answers

Run this command

npm install -g react-native-cli

after that just add your npm path to your system variables in environment variables

C:\Users\YOUR USERNAME\AppData\Roaming\npm

I also have this problem. It got fixed by first typing following command:

npm i react-native 

then:

yarn react-native init AwesomeProject

and it worked!!

Following is the screenshot of it

Related