react 19出之后create-react-app报错了
来源:2-2 【环境搭建】开始我们的第一个React项目

gyy_
2024-12-19
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template…
added 1320 packages in 19s
256 packages are looking for funding
run npm fund
for details
Initialized a git repository.
Installing template dependencies using npm…
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@0.1.0
npm ERR! Found: react@19.0.0
npm ERR! node_modules/react
npm ERR! react@"^19.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/liaozhuodi/.npm/_logs/2024-12-19T05_07_49_701Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /home/liaozhuodi/.npm/_logs/2024-12-19T05_07_49_701Z-debug-0.lognpm 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
2回答
-
阿莱克斯刘
2024-12-22
使用 Create React App 创建一个 React 18 项目非常简单。以下是步骤:
1. 确保你已安装了 Node.js 和 npm。你可以在终端中运行 `node -v` 和 `npm -v` 来检查。
2. 打开终端,运行以下命令来全局安装 Create React App:
npx create-react-app my-react-app
3. 进入项目目录
cd my-react-app
4. 安装 React 18:
npm install react@18 react-dom@18
5. 启动开发服务器:
npm start
这样,你就可以在浏览器中访问 `http://localhost:3000` 来查看你的 React 18 项目了。希望这能帮到你!如果还有其他问题,尽管告诉我。012025-01-02 -
qq_慕桂英6324852
2024-12-21
我也是这样 你先进入项目 把一些测试文件删掉 看看项目缺什么 你在 npm i 下载一下
00
相似问题
回答 3