When encountering the error message “preset react-native not found” in a React Native project, it means that the required configuration preset is missing. This problem usually occurs when running a new or existing project that doesn’t have the necessary dependencies configured properly.
To resolve this issue, you can follow these steps:
- Make sure you have the required dependencies installed. Run the following command in your project’s directory:
npm install --save-dev babel-preset-react-native
. -
Check your project’s
.babelrc
file to ensure that the preset is correctly defined. The file should contain the following configuration:{ "presets": ["react-native"] }
-
If your project doesn’t have a
.babelrc
file, create one in the root directory of your project using the given configuration.
Once you have completed these steps, try running your React Native project again. The “preset react-native not found” error should no longer occur.