使用create-react-app appname创建新的react应用程序时出错

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

使用 npm 安装模板依赖项...

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"^19.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.0.0" from @testing-library/[email protected]
npm error node_modules/@testing-library/react
npm error   @testing-library/react@"^13.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error

给出解决方案来解决这个问题

create-react-app
1个回答
0
投票

如果你确实需要 lib @testing-library/react。您可以使用以下命令安装它:

npm i @testing-library/react

PS:@testing-library/[电子邮件受保护]需要react@“^18.0.0”并且create-react-app正在使用react 19

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