【问题标题】:Unable to install "@react-navigation/stack" using `npm install @react-navigation/stack` in reactNative无法在 reactNative 中使用 `npm install @react-navigation/stack` 安装“@react-navigation/stack”
【发布时间】:2021-10-09 08:11:52
【问题描述】:

React Native 应用程序中制作导航需要使用 npm install @react-navigation/stack 安装 @react-navigation/stack,我已经尝试过,但每次都失败。

NPM 版本: 7.19.1 节点版本: v15.14.0 世博版: 4.8.1

运行npm install @react-navigation/stack这个命令后,我遇到了以下错误,

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @react-navigation/native@3.8.4
npm ERR! node_modules/@react-navigation/native
npm ERR!   @react-navigation/native@"^3.8.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @react-navigation/native@"^6.0.0" from @react-navigation/stack@6.0.1
npm ERR! node_modules/@react-navigation/stack
npm ERR!   @react-navigation/stack@"*" 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 /home/imdadul/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/imdadul/.npm/_logs/2021-08-04T07_46_39_555Z-debug.log

注意:请关注附件,知道这方面的人会帮助我。 高级感谢!

【问题讨论】:

    标签: javascript react-native mobile-application react-navigation-stack expo


    【解决方案1】:

    您有依赖关系冲突,这意味着依赖关系不正确并且可能损坏。您可以尝试使用--force--legacy-peer-deps 运行命令,看看是否有帮助。

    npm install @react-navigation/stack --force
    

    npm install @react-navigation/stack --legacy-peer-deps
    

    有时删除node_modulespackage-lock.json 文件并运行命令npm install @react-navigation/stack 或尝试npm cache clean --force 可以工作。

    【讨论】:

      猜你喜欢
      • 2020-11-07
      • 2021-07-06
      • 2020-11-05
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-04
      相关资源
      最近更新 更多