'react-native' is not recognized as an internal or external command, operable program or batch file

I recently started with react-native. I install it using the tutorial on the facebook site and everything works well for a day or two, until this message comes up:

'react-native' is not recognized as an internal or external command,
operable program or batch file.

Nothing works except uninstalling everything and starting all over again. The environments are ok and work (npm, choco, etc.). I have also tried removing and adding react-native to environment variables, restarting, running cmd in administrator mode, but nothing so far. I should add that I use windows 10 64-bit.


Solution 1:

I had the same issue and tried the following but didnt work 1) Adding npm path to my Environment variables; both system and user 2) Re install npm and react-native-cli

Both didn't work for me, im using Windows 10;

Solution that worked for me is to install react-native-cli globally You can install it globally by using the below command:

npm install -g react-native-cli

Hope that helps you! Cheers :)

Solution 2:

You can simply use npx react-native <command> it will work