If you get this error when trying to create a react native project it means that the react cli is not installed globaly.
You need to unistall react-native-cli using the following command:
npm uninstall -g react-native-cli
After that reinstall react-native-cli and react-native globaly using the commands:
npm install -g react-native-cli
npm install -g react-native
When you are done installing you can create a new project using
npx react-native init ProjectName