npx create-react-app react-basic 创建react 项目报错

发布于:2024-10-08 ⋅ 阅读:(189) ⋅ 点赞:(0)

npx create-react-app创建react 项目报错

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react-basic@0.1.0
npm error Found: react@undefined
npm error node_modules/react
npm error   react@"*" from the root project
npm error
npm error Could not resolve dependency:
npm error react-scripts@"*" from the root project
npm error
npm error Conflicting peer dependency: react@18.3.1
npm error node_modules/react
npm error   peer react@">= 16" from react-scripts@5.0.1
npm error   node_modules/react-scripts
npm error     react-scripts@"*" 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 C:\Users\user\AppData\Local\npm-cache\_logs\2024-10-01T09_32_22_760Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache\_logs\2024-10-01T09_32_22_760Z-debug-0.log

解决方法

npm install -g create-react-app

修改镜像

npm config set registry http://registry.npm.taobao.org

再创建一下react项目试一下~

npx create-react-app react-basic

网站公告

今日签到

点亮在社区的每一天
去签到