Kyoui
Kyoui

Reputation: 35

React native navigation : Unable to resolve module react-navigation

I think this problem came after i pushed my project to github, i already installed according to the official doc, everything seems fine but still.

I already : -Reinstalled with npm install @react-navigation/native

-Reinstalled the dependencies :expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

-Deleted node_modules then npm install

Error message :

Unable to resolve module react-navigation from D:\Prog\Agora\Agora\node_modules\react-native-screens\src\createNativeStackNavigator.tsx: react-navigation could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  36 |   NavigationAction,
  37 |   NavigationProp,
> 38 | } from 'react-navigation';
     |         ^
  39 | import { NativeStackNavigationOptions as NativeStackNavigationOptionsV5 } from './native-stack/types';
  40 | import { HeaderBackButton } from 'react-navigation-stack';
  41 | import {

enter image description here

Upvotes: 0

Views: 1431

Answers (1)

ridvanaltun
ridvanaltun

Reputation: 3020

You are using React Navigation 4.x in your code but your are using React Navigation 5.x as package, React Navigation 4.x not works on 5.x. You can upgrade your code via official documentation here: https://reactnavigation.org/docs/upgrading-from-4.x/

Or you can change your package to 4.x.

Upvotes: 2

Related Questions