"React Native version mismatch" errors
Edit page
Learn about what React Native version mismatch means and how to resolve it in an Expo or React Native app.
When developing an Expo or React Native app, it's common to run into an error that looks like:
React Native version mismatch.JavaScript version: X.XX.XNative version: X.XX.XMake sure you have rebuilt the native code...What this error means
The bundler that you're running in your terminal (using npx expo start) is using a different JavaScript version of react-native than the native app on your device or emulator. This can happen after upgrading your React Native or Expo SDK version, or when connecting to the wrong local development server.
How to fix it
-
Close out any development servers that you have running (you can list all terminal processes with the
pscommand, and search for Expo CLI or React Native community CLI processes withps -A | grep "expo\|react-native"). -
If this is a Expo project, either remove the
sdkVersionfield from your app.json file, or make sure it matches the value of theexpodependency in your package.json file. -
If this is a Expo project, you should make sure your
react-nativeversion is correct. Runnpx expo-doctorwill show a warning where thereact-nativeversion you should install. If you did upgrade to a newer SDK, make sure to runnpx expo install --fixand follow the prompts. Expo CLI will make sure that your dependency versions for packages likeexpoandreact-nativeare aligned. -
If this is a bare React Native project, and this error is occurring right after upgrading your React Native version, you should double-check that you have performed each of the upgrade steps correctly.
-
Finally:
- Clear your bundler caches by running
rm -rf node_modules && npm cache clean --force && npm install && watchman watch-del-all && rm -rf $TMPDIR/haste-map-* && rm -rf $TMPDIR/metro-cache && npx expo start --clear - If this is a bare React Native project, run
npx pod-install, then rebuild your native projects (runyarn androidto rebuild for Android, andyarn iosto rebuild iOS)
- Clear your bundler caches by running