在运行npm安装时,我得到了以下错误:
While resolving: material-app@3.0.0
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@"^0.14.9 || ^15.3.0 || ^16.0.0" from react-quill@1.3.5
npm ERR! node_modules/react-quill
npm ERR! dev react-quill@"1.3.5" 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.我试着删除包-json,删除节点模块并重新安装它们,但仍然无法解决。请给我关于如何修理它的建议。
发布于 2022-04-01 12:35:30
似乎是React quill 1.3.5在运行React v17时使用React ^16.0.0而不是将^17.0.0作为依赖项。
来自另一个职位:
由于大量模块没有将React v17专门添加为peerDependency,因此在运行v17 React应用程序时遇到无法解决依赖树错误的情况已经司空见惯。 每当模块(或其自身的任何依赖项)将以前版本的React作为peerDependency列出时,这个错误就会触发,而没有具体地包括React v17。
新版本的(v2.0.0-beta版)正在使用React v17,因此可以选择安装它。
npm install react-quill@beta发布于 2022-04-05 12:05:52
存在依赖树冲突。遵循以下原则:
react-quill@beta,或更新react quill到beta的版本,因为它支持使用npm update react-quill@beta的react 17。https://stackoverflow.com/questions/71706380
复制相似问题