依赖冲突`npm install --no-audit --save @testing-library/jest-dom@^5.14.1...` failed

使用react脚手架Create React App创建react应用

使用npm init react-app my-app,过程中报错

安装依赖时,React版本与模版预设版本不一致,根据提示修改依赖版本,改为19.0.0

复制代码
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 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^19.0.0 @types/react-dom@^19.0.0 typescript@^4.4.2 web-vitals@^2.1.0 --legacy-peer-deps

或者将模版项目中 package.json 中React版本改为18.0.0

复制代码
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 @types/jest@^27.0.1 @types/node@^16.7.13 @types/react@^18.0.0 @types/react-dom@^18.0.0 typescript@^4.4.2 web-vitals@^2.1.0
相关推荐
扶风ff4 小时前
新品知识更新太快?用练题簿在线刷题,安排企业培训的小测与复盘
前端·学习·小程序
对空六课4 小时前
支持注意力分析的热力图工具有哪些?
前端·数据库·数据分析
Csvn5 小时前
Vue3 响应式与编译:依赖收集如何升级为节点级靶向更新
前端
星栈6 小时前
pnpm 12 升级实测
前端·javascript
Sirens.7 小时前
Java并发锁详解:六类锁策略与 synchronized 底层原理
java·前端·算法
特创数字科技8 小时前
一个纯本地运行的图片处理工具:压缩 / 裁剪 / 九宫格 / 圆角 / 滤镜 / 拼图 / 水印,终生使用
前端
IT_陈寒9 小时前
Vue的v-if和v-for混用居然是个天坑
前端·人工智能·后端
天衍四九-9 小时前
【无标题】
前端·spring boot·mysql·nginx·docker
广州华水科技9 小时前
2026年单北斗GNSS变形监测系统推荐榜单,解锁GNSS位移监测新高度
前端
xcyxiner9 小时前
DicomViewer24 修复编译bug(window test 失败)
前端·qt