安装反应类型包时无法解析依赖树



我试图去节点模块中的@testing-library/react文件夹,并将所有的react版本更改为与当前版本相同的版本,即18.2.0,尽管知道react版本不同。我知道还有一些文件夹与不兼容的树依赖关系,但我认为这与反应类型的包有关。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-typed@1.2.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.4.0
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^13.4.0" from the root project
npm ERR!   3 more (react-dom, react-icons, react-scripts)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from react-typed@1.2.0
npm ERR! node_modules/react-typed
npm ERR!   react-typed@"^1.2.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.3.0" from react-typed@1.2.0
npm ERR!   node_modules/react-typed
npm ERR!     react-typed@"^1.2.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 /vercel/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /vercel/.npm/_logs/2022-12-13T14_24_46_461Z-debug-0.log
Error: Command "npm install" exited with 1

更改模块内的依赖对等体当安装react类型时,我使用

--legacy-peer-deps

也是如此,当我尝试部署它时,仍然会给我这些错误。一直以来,它都没有在做项目时给我这个错误…

这个错误来自版本7。

请使用--legacy-peer-deps选项再试一次。

$ npm install --save react-typed --legacy-peer-deps

或尝试降级npm v6:

npm install -g npm@6

最新更新