使用npx create-react-app创建React项目时依赖树解析失败求助
React应用创建依赖冲突问题求助
尝试使用npx create-react-app my-app创建React应用时遇到如下错误:
编辑补充:我的问题被踩且关闭,理由是已有相关问题解答,但我发帖前已查看,该问题并未解决我的问题,这个机制不太好用。
Creating a new React app in /home/aaliyah/temp/amazon_clone/my-app. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template... added 1323 packages in 10s 267 packages are looking for funding run `npm fund` for details Installing template dependencies using npm... npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: my-app@0.1.0 npm error Found: react@19.0.0 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/react@13.4.0 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 npm error For a full report see: npm error /home/aaliyah/.npm/_logs/2025-01-20T15_10_36_965Z-eresolve-report.txt npm error A complete log of this run can be found in: /home/aaliyah/.npm/_logs/2025-01-20T15_10_36_965Z-debug-0.log `npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0` failed
已尝试的解决方法:
- 使用
--force和--legacy-peer-deps参数,无效 - 尝试降级React版本,无效
- 查看完整日志,未找到有效信息
- 多次咨询ChatGPT,未解决
系统环境:Linux Mint,x86架构,求可行的解决方案,谢谢!
内容的提问来源于stack exchange,提问作者aaliyah
相关产品推荐
相关产品推荐

