javascript - 安装@react-navigation/stack@5.14.3 时无法解析依赖树

标签 javascript node.js reactjs react-native npm

我创建了一个新项目 react-native init MyProject在 VSCode 中打开它后,我做的第一件事就是安装导航。npm install @react-navigation/native @react-navigation/stack它抛出错误,然后我分别做了这意味着我首先做了npm install @react-navigation/native它安装成功然后我做了npm install @react-navigation/stack然后错误又来了:

 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency
 tree npm ERR!  npm ERR! While resolving: MyProject@0.0.1 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-navigation/stack@5.14.3 npm ERR!  
 node_modules/@react-navigation/stack npm ERR!    
 @react-navigation/stack@"^5.14.2" from the root project npm ERR!  npm
 ERR! Could not resolve dependency: npm ERR! peer react@"^16.0" from
 @react-native-community/masked-view@0.1.10 npm ERR!
 node_modules/@react-native-community/masked-view npm ERR!  
 @react-native-community/masked-view@"^0.1.10" from the root project
 npm ERR!   peer @react-native-community/masked-view@">= 0.1.0" from  
 @react-navigation/stack@5.14.3 npm ERR!  
 node_modules/@react-navigation/stack npm ERR!    
 @react-navigation/stack@"^5.14.2" 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. npm ERR! 
 npm ERR! See /Users/chaudhrytalha/.npm/eresolve-report.txt for a full
 report.
 
 npm ERR! A complete log of this run can be found in: npm ERR!    
 /Users/chaudhrytalha/.npm/_logs/2021-03-17T10_09_02_128Z-debug.log
我什至尝试安装 npm install @react-native-community/masked-view但得到类似的错误。

最佳答案

这将解决问题
npm install --legecy-peer-deps @react-navigation/stack --force

关于javascript - 安装@react-navigation/stack@5.14.3 时无法解析依赖树,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66671039/

相关文章:

javascript - Sequelize 调用结构

javascript - 如何使用 Node.js 检查目录是否为空?

javascript - 使用 "setTimeout()"时的执行顺序是什么?

javascript - 按钮展开显示在页面上,尽管在单击按钮本身之前它应该被隐藏

node.js - 在开始我的项目之前,我首先需要 docker 环境吗?

reactjs - Material UI 选择字段多选

reactjs - React with Typescript——使用 React.forwardRef 时的泛型

javascript - 未捕获的 TypeError : (0 , _jquery2.default)(...).sortable 不是函数

javascript - Highstocks 时代时间与时区不匹配

javascript - 在 vis.js 中使用 css 设置网格轴样式