Implementing React Navigate in the project installing the package npm install @react-navigation/native @react-navigation/stack
shows the following error.
Can anyone help me with this issue?
Implementing React Navigate in the project installing the package npm install @react-navigation/native @react-navigation/stack
shows the following error.
Can anyone help me with this issue?
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.
@react-navigation
the way I resolved is by installing "react-native-safe-area-context": "3.2.0"
in package.json
expo
CLI is deprecated, npx expo install --fix
is here to fix dependencies.
Commented
Mar 27 at 18:10
Stop running your app. Do npx pod-install ios. Then rebuild your app. This worked for me.
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!
expo doctor --fix-dependencies
to fix those