依赖冲突`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
相关推荐
爱勇宝11 小时前
鸿蒙生态的下半场:开发者不只要能开发,还要能赚钱
android·前端·程序员
IT_陈寒14 小时前
SpringBoot这个自动配置坑我跳了三次
前端·人工智能·后端
kyriewen14 小时前
我用 AI 一周写完了整个项目,上线第一天就崩了——这是我踩过最贵的 5 个坑
前端·javascript·ai编程
牧艺14 小时前
从零到协同:构建类飞书在线文档系统的五个技术重难点
前端·人工智能
红尘散仙15 小时前
想写一个像样的终端 App?试试把 React 的开发体验搬进 Rust TUI
前端·rust
袋鼠云数栈UED团队16 小时前
一套 Spec-First 的 AI 编程工作流
前端·人工智能
袋鼠云数栈前端16 小时前
一套 Spec-First 的 AI 编程工作流
前端·ai+
angerdream16 小时前
Android手把手编写儿童手机远程监控App之vue3 路由守卫
前端
不服老的小黑哥16 小时前
AI规范驱动编程-harness工程项目实战
前端
vivo互联网技术16 小时前
从 Web 到桌面:基于 Tauri 2.0 + Vue 3 打造 vivo 线下门店「大头贴」拍照体验系统
前端·rust