为什么当我尝试安装另一个依赖项时会收到有关一个依赖项的错误?

问题描述 投票:0回答:1

当我尝试安装 @types/react 和 @types/react-dom 时,出现有关依赖项冲突的错误。这个错误是什么意思?我的 React-persian-datepicker 包出了什么问题?我认为问题来自于这种依赖性。 (因为这是我在此之前安装的最后一个依赖项)

P:\My React Projects\test-project>npm install -D @types/react @types/react-dom
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^18.2.0" from [email protected]
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@">=16.8" from [email protected]
npm ERR!     node_modules/react-router-dom
npm ERR!       react-router-dom@"^6.21.1" from the root project
npm ERR!     peer react-dom@"^18.0.0" from @testing-library/[email protected]
npm ERR!     node_modules/@testing-library/react
npm ERR!       @testing-library/react@"^13.0.0" from the root project
npm ERR!     1 more (the root project)
npm ERR!   peer react@">=16.8" from [email protected]
npm ERR!   node_modules/react-router
npm ERR!     react-router@"6.21.1" from [email protected]
npm ERR!     node_modules/react-router-dom
npm ERR!       react-router-dom@"^6.21.1" from the root project
npm ERR!   4 more (react-scripts, react-router-dom, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.2.1" from [email protected]
npm ERR! node_modules/react-persian-datepicker
npm ERR!   react-persian-datepicker@"^3.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^15.2.1" from [email protected]
npm ERR!   node_modules/react-persian-datepicker
npm ERR!     react-persian-datepicker@"^3.0.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.
reactjs dependencies
1个回答
0
投票

您的波斯语日期选择器仅适用于react@^15.2.1及更早的版本。 你正在运行react18,因此会发生冲突。

检查persian-datepicker是否可以更新到可以在react18上运行的较新版本。

© www.soinside.com 2019 - 2024. All rights reserved.