【问题标题】:How do I fix this NPM dependency issue for react-native-spotify-remote如何解决 react-native-spotify-remote 的这个 NPM 依赖问题
【发布时间】:2020-11-15 13:50:29
【问题描述】:

我无法弄清楚如何解决我遇到的依赖相关问题。我正在尝试在新的 React Native 项目中安装 npm 模块 react-native-spotify-remote,但出现以下错误:

$ npx react-native init test && cd test
$ npm i --save react-native-spotify-remote
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test@0.0.1
npm ERR! Found: react-native@0.63.3
npm ERR! node_modules/react-native
npm ERR!   react-native@"0.63.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.61.5" from react-native-spotify-remote@0.3.2
npm ERR! node_modules/react-native-spotify-remote
npm ERR!   react-native-spotify-remote@"*" 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 C:\Users\xxx\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Local\npm-cache\_logs\2020-11-15T13_40_38_674Z-debug.log

当我阅读此错误时,在我看来,react-native-spotify-remote 在 0.61.5 或更高版本上具有 react-native 的依赖关系,并且安装了 0.63.3 版本。这不意味着依赖得到满足吗?我知道通过将 react-native 降级到早期版本,如他们的示例应用程序中所使用的那样,我可能可以解决这个问题,但我想先尝试了解为什么这不起作用,理想情况下我想使用最新版本.

使用--force--legacy-peer-deps 标志也不能解决问题。

我还在 GitHub 存储库上打开了一个 issue,但到目前为止也没有运气。

【问题讨论】:

  • 您是否尝试过删除 node_modules 文件夹和 package-lock.json 并运行 npm installnpm cache clean --force
  • @JonahG 刚刚尝试过,但不幸的是没有运气。

标签: node.js react-native npm npm-install


【解决方案1】:

看起来是 npm 的 Peer Dependencies 有问题,试试:

npm install --legacy-peer-deps

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-23
    • 2023-01-24
    • 1970-01-01
    • 2011-11-07
    • 2021-12-05
    • 1970-01-01
    • 2016-08-03
    • 2021-10-07
    相关资源
    最近更新 更多