58

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?

2
  • 4
    You are forgot run pod install check document againt github.com/react-navigation/react-native-safe-area-view
    – Anhdevit
    Commented May 23, 2020 at 3:32
  • 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
    Commented Jul 11, 2020 at 7:59

3 Answers 3

52

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.

2
  • I had the same issue while using @react-navigation the way I resolved is by installing "react-native-safe-area-context": "3.2.0" in package.json
    – Morris S
    Commented Mar 16, 2022 at 14:34
  • Since expo CLI is deprecated, npx expo install --fix is here to fix dependencies.
    – BillTheKid
    Commented Mar 27 at 18:10
49

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

1
  • Just to clarify: you need to rebuild the app in xcode, not just your js bundle in metro
    – shadowusr
    Commented Jun 12, 2021 at 18:40
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!

1
  • 1
    Fyi, you can run expo doctor --fix-dependencies to fix those
    – Wodin
    Commented Jul 23, 2022 at 13:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.