React-Native:无法解决“反应导航”

时间:2020-08-27 16:24:06

标签: reactjs react-native npm react-navigation

嗨,所以我试图在应用程序内的react-native内创建一个android应用程序,我尝试使用react-navigation,当我使用npx react-native run-android运行程序时遇到以下错误: / p>

error: Error: Unable to resolve module `@react-navigation/stack` from `src\nav\nav.js`: @react-navigation/stack 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: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
    at ModuleResolver.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\node-haste\DependencyGraph.js:287:16)
    at Object.resolve (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\lib\transformHelpers.js:267:42)
    at C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:434:31
    at Array.map (<anonymous>)
    at resolveDependencies (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:431:18)
    at C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\Ike\Desktop\Again\project\Project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)

我尝试了很多事情,包括在尝试构建程序时使用yarn而不是npm。我也尝试过删除node_modules并从packages.json中删除react-navigation,甚至npm install --save react-navigation

1 个答案:

答案 0 :(得分:0)

您还安装了所有依赖项吗? react-native-gesture-handler,react-native-reanimated,react-native-screens,react-native-safe-area-context和@ react-native-community / masked-view