node.js - 无法解析依赖树,我不再可以使用节点包管理器安装包
问题描述
我正在开发一个反应原生应用程序。在整个项目中,我使用 Node 包管理器来安装包。但是我第一次尝试用npm安装react-native-styled-components时遇到了这个依赖问题,所以我用yarn安装了它。现在我无法使用节点包管理器安装任何包,我遇到了无法解决依赖关系树错误。
PS C:\Users\94774\OneDrive\React Projects\Native Projects\Android\socialmediaapp> npm install react@latest react-native@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: socialmediaapp@0.0.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native@0.64.1
npm ERR! node_modules/react-native
npm ERR! react-native@"0.64.1" 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\94774\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\94774\AppData\Local\npm-cache\_logs\2021-05-06T12_12_44_173Z-debug.log
PS C:\Users\94774\OneDrive\React Projects\Native Projects\Android\socialmediaapp> npm install --save @react-native-firebase/app
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: socialmediaapp@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@">= 16.8.0" from styled-components@5.3.0
npm ERR! node_modules/styled-components
npm ERR! styled-components@"^5.3.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-dom@17.0.2
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@">= 16.8.0" from styled-components@5.3.0
npm ERR! node_modules/styled-components
npm ERR! styled-components@"^5.3.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.
npm ERR!
npm ERR! See C:\Users\94774\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\94774\AppData\Local\npm-cache\_logs\2021-05-06T12_41_01_675Z-debug.log
解决方案
npm install react-native-styled-components --legacy-peer-deps
推荐阅读
- java - 将命令行参数传递给不同的类
- r - Checkresiduals:resi[1:(n - x)] 中的错误:只有 0 可能与负下标混合
- intellij-idea - IntelliJ IDEA 2020.2 不在 Debain 10 中渲染字体
- python - 如何在熊猫数据框中过滤小写的行和单词?
- bert-language-model - 为什么 huggingfaces 的 FlauBERT 模型中没有 pooler 层?
- javascript - 用于加载 HTML 表格而不是图片 (PNG) 的 JavaScript 调整代码
- python - 是否应该在 doctests 中重复导入?
- python - 函数不可调用?
- node.js - 如何使用 mongo DB 中的另一个集合中的数据与 nodejs 的一个 2 多映射进行排序?
- r - r - 如何删除字符中带有文本的一对括号?