For anyone facing this errors, to resolve the problem, make sure:
- You are in the project folder
- You already did npm install (or yarn install if you use yarn instead of npm)
- react-native is already in your package.json
- You properly did react-native init to create your project (in case you’re starting an afresh app) – no error, hanging, or early termination during the process.
- Already set up your environment correctly according to the docs https://reactnative.dev/docs/environment-setup