Skip to content Skip to sidebar Skip to footer

Unable To Resolve Module 'react-navigation' From .../App.js: Module 'react-navigation' Does Not Exist In The Haste Module Map

I have just setup an app to start building it out and I keep getting this error from my App.js. This is a part of a udemy course in which I have followed every instruction to a T..

Solution 1:

Make sure to install react-navigation with npm i react-navigation


Solution 2:

First of all you have to use CMD to run this commands.

  1. If your system is Windows, set your environment variable, add %SystemRoot%\system32 to your PATH I met this error yesterday,hope it works to you. Don't forget to reboot you PC.

After that :

  1. Create your project : npx expo-cli init <projectname>

Then :

  1. Install React Navigation :

    npm install react-navigation
    
  2. Install Dependencies :

    expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view
    
  3. Install React Navigation Stack :

    npm install react-navigation-stack @react-native-community/masked-view
    
  4. Start the app and clear cache with npm start -c.

Update Imports Our imports in the upcoming lecture will now look like this :

import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';

Errors?

If you are still seeing errors and complaints about packages, do the following :

  1. rm -r node_modules

  2. rm package-lock.json

  3. expo upgrade

  4. npm start -c


Solution 3:

Do this it will definitely work :

npm install --legecy-peer-deps react-navigation

or

npm install --legecy-peer-deps react-navigation --force

Post a Comment for "Unable To Resolve Module 'react-navigation' From .../App.js: Module 'react-navigation' Does Not Exist In The Haste Module Map"