依赖冲突`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
相关推荐
o***Z4481 小时前
前端性能优化案例
前端
张拭心1 小时前
前端没有实际的必要了?结合今年工作内容,谈谈我的看法
前端·ai编程
姜太小白1 小时前
【前端】CSS媒体查询响应式设计详解:@media (max-width: 600px) {……}
前端·css·媒体
HIT_Weston1 小时前
39、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(二)
linux·前端·ubuntu
百***06011 小时前
SpringMVC 请求参数接收
前端·javascript·算法
天外天-亮1 小时前
Vue + excel下载 + 水印
前端·vue.js·excel
起个名字逛街玩1 小时前
前端正在走向“工程系统化”:从页面开发到复杂产品架构的深度进化
前端·架构
用户47949283569152 小时前
React 渲染两次:是 Bug 还是 Feature?聊聊严格模式的“良苦用心”
前端·react.js·前端框架
b***74882 小时前
前端GraphQL案例
前端·后端·graphql
云飞云共享云桌面2 小时前
无需配置传统电脑——智能装备工厂10个SolidWorks共享一台工作站
运维·服务器·前端·网络·算法·电脑