'@ react-navigation / stack'已停止处理错误-无法解析模块

时间:2020-02-14 13:11:46

标签: react-native expo react-navigation-stack react-navigation-v5

我已经成功使用React Navigation Stack(V5)大约一周了,今天我的应用将无法构建,因为该错误-现在显示无法解析模块。

Error Message

该模块的安装如我的package.json文件中所示-

{
  "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
}

我尝试了以下步骤来尝试解决问题-

  1. 已删除的node_modules
  2. 清纱和npm缓存
  3. 安装npm再次安装依赖项
  4. 清除的博览会缓存
  5. 在iOS设备上删除并重新定义了世博会应用程序
  6. 还尝试再次安装react navigation stack软件包

仍然收到相同的错误消息。

将非常感谢任何想法。.目前,我对此感到迷茫:|

2 个答案:

答案 0 :(得分:0)

尝试删除package-lock文件并运行npm i

答案 1 :(得分:0)

您的package.json中没有@ react-navigation / stack或任何@ react-navigation / xxx软件包。您有适用于v4的react-navigation-xxx软件包。

按照入门指南进行正确设置https://reactnavigation.org/docs/en/getting-started.html