53

Implementing React Navigate in the project installing the package npm install @react-navigation/native @react-navigation/stack shows the following error.

THIS IS MY ERROR

Can anyone help me with this issue?

Vladimir Salguero
  • 5,609
  • 3
  • 42
  • 47
da coconut
  • 809
  • 2
  • 9
  • 11
  • 4
    You are forgot run pod install check document againt https://github.com/react-navigation/react-native-safe-area-view – Anhdevit May 23 '20 at 03:32
  • 6
    I'm having the same issue building an expo app in Android. This started happening when trying to setup following the procedures declared in https://reactnavigation.org/docs/getting-started, still have the same issue after running `expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view` – Patricio Marrone May 23 '20 at 16:20
  • Props for showing the error message, but it should ideally be in text rather than an image. Also, we'll need to see some example code that produces the error (unless what Anh mentioned is the only possible cause of this). – Brilliand Jul 11 '20 at 07:59

3 Answers3

50

TL;DR

Try upgrading your expo CLI with npm install -g expo-cli and running expo update to fix the dependencies.

My case

I experienced this issue today in an expo app while trying to setup React Navigation.

I noticed this message in the console when launching expo

Some of your project's dependencies are not compatible with currently installed expo package version:
 - react-native-reanimated - expected version range: ~1.7.0 - actual version installed: ^1.9.0
 - react-native-screens - expected version range: ~2.2.0 - actual version installed: ^2.8.0
 - react-native-safe-area-context - expected version range: 0.7.3 - actual version installed: ^2.0.0
 - @react-native-community/masked-view - expected version range: 0.1.6 - actual version installed: ^0.1.10
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]

Updating expo and running expo update to set the dependencies to something compatible with my SDK seemed to solve the issue for me

npm install -g expo-cli
expo update

I noticed that some dependencies were reverted to older versions that now seem to work. E.g. (in package.json):

-"react-native-safe-area-context": "^2.0.0",
+"react-native-safe-area-context": "0.7.3",

Even when the warning message explicitly instructed me to run the expo install for each problematic dependency, doing so would lead to the same version that was throwing the error.

Patricio Marrone
  • 1,287
  • 15
  • 20
47

Stop running your app. Do npx pod-install ios. Then rebuild your app. This worked for me.

3

expo update did not work for me unfortunately :(

When running yarn start in my console, I got:

Some of your project's dependencies are not compatible with currently installed expo package version:
 - react-native-reanimated - expected version range: ~1.7.0 - actual version installed: ^1.9.0
 - react-native-screens - expected version range: ~2.2.0 - actual version installed: ^2.8.0
 - react-native-safe-area-context - expected version range: 0.7.3 - actual version installed: ^3.0.2
 - @react-native-community/masked-view - expected version range: 0.1.6 - actual version installed: ^0.1.10
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]

I ran expo install <package>@<version> for each of the shown packages, and it is working now!

justindao
  • 2,273
  • 4
  • 18
  • 34