0

I'm trying react-native for the first time and trying to create a stack navigation, I'm getting the following error:

Unable to resolve "@react-navigation/stack" from "App.js"

This is mu package.json file:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.7.0",
    "expo": "~38.0.8",
    "expo-status-bar": "^1.0.2",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-reanimated": "^1.9.0",
    "react-native-safe-area-context": "^3.0.7",
    "react-native-screens": "^2.9.0",
    "react-native-web": "~0.11.7",
    "react-navigation": "^4.4.0",
    "react-navigation/stack@": "^5.7.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "babel-preset-expo": "~8.1.0"
  },
  "private": true
}

I'm using expo cli to fire up my application.

2
  • "react-navigation/stack@": "^5.7.0" looks wrong "@react-navigation/stack": "^5.7.0" If this isn't work. please share code of app.js as well, were u are calling the stack Commented Jul 14, 2020 at 19:13
  • "react-navigation/stack@" I don't think that's right, it should've been "@react-navigation/stack" Commented Jul 14, 2020 at 19:13

1 Answer 1

1

You have react-navigation/stack@ installed, and are trying to import @react-navigation/stack.

Remove react-navigation/stack@, since it's not the right import, and install @react-navigation/stack with npm install --save @react-navigation/stack.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.