首页 > 解决方案 > 如何解决导航包

问题描述

每当我尝试运行 Navigation for React Native 项目的安装命令来创建抽屉时,我都会收到以下错误,这是我尝试过的命令

npm install @react-navigation/native

我收到以下错误

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!   peer react@"*" from react-native-reanimated@1.9.0
npm ERR!   node_modules/react-native-reanimated
npm ERR!     react-native-reanimated@"~1.9.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"16.8.6" from react-native@0.60.6
npm ERR! node_modules/react-native
npm ERR!   react-native@"^0.60.5" from the root project
npm ERR!   peer react-native@"*" from react-native-reanimated@1.9.0
npm ERR!   node_modules/react-native-reanimated
npm ERR!     react-native-reanimated@"~1.9.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

有人可以帮我解决这个问题吗?

标签: react-native

解决方案


试试npm install --save --legacy-peer-deps。如果不起作用,请参阅:

安装 npm 包时无法解决依赖关系树错误


推荐阅读