0

I have been successfully using React Navigation Stack (V5) for about a week now and today my app will not build as the error - unable to resolve module is now shown.

Error Message

The module is installed as shown in my package.json file -

{
  "scripts": {
    "postinstall": "jetify",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.6",
    "expo": "~36.0.0",
    "expo-linear-gradient": "^8.0.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "~0.61.4",
    "react-native-fontawesome": "^7.0.0",
    "react-native-gesture-handler": "^1.5.6",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-reanimated": "^1.7.0",
    "react-native-safe-area-context": "^0.7.2",
    "react-native-screens": "^2.0.0-beta.2",
    "react-native-unimodules": "~0.7.0",
    "react-native-web": "~0.11.7",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.10.3"
  },
  "devDependencies": {
    "@babel/core": "~7.6.0",
    "babel-jest": "~24.9.0",
    "jest": "~24.9.0",
    "jetifier": "~1.6.4",
    "metro-react-native-babel-preset": "~0.56.0",
    "react-test-renderer": "~16.9.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "private": true
}

I have tried the following steps to try resolve the issue -

  1. Deleted node_modules
  2. Cleared yarn and npm cache
  3. Ran npm install to install dependencies again
  4. Cleared expo cache
  5. Deleted and re-downoaded expo app on iOS device
  6. Also tried installing the react navigation stack package again

Still receiving the same error message.

Would MASSIVELY appreciate any ideas.. currently losing my head over this :|

BlueChip
  • 31
  • 1
  • 6

2 Answers2

0

Try to delete the package-lock file and run npm i

0

You don't have @react-navigation/stack or any @react-navigation/xxx packages in your package.json. You have react-navigation-xxx packages which are for v4.

Follow the getting started guide to set it up properly https://reactnavigation.org/docs/en/getting-started.html

satya164
  • 9,464
  • 2
  • 31
  • 42
  • That's the thing... I had already set it up properly, and it was working perfectly. I figured it out that for some reason when I installed the expo-image-picker package, the react-navigation-stack and react-navigation-native packages got removed? So I had to reinstall them. No idea why it happened but its fixed now thanks. – BlueChip Feb 15 '20 at 17:12