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

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

bash 复制代码
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

解决方法

bash 复制代码
npm install -g create-react-app

修改镜像

bash 复制代码
npm config set registry http://registry.npm.taobao.org

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

bash 复制代码
npx create-react-app react-basic
相关推荐
jiayu19 分钟前
Angular学习笔记24:Angular 响应式表单 FormArray 与 FormGroup 相互嵌套
前端
jiayu20 分钟前
Angular6学习笔记13:HTTP(3)
前端
小码哥_常24 分钟前
Kotlin抽象类与接口:相爱相杀的编程“CP”
前端
evelynlab24 分钟前
Tapable学习
前端
LeeYaMaster38 分钟前
15个例子熟练异步框架 Zone.js
前端·angular.js
evelynlab41 分钟前
打包原理
前端
拳打南山敬老院1 小时前
Context 不是压缩出来的,而是设计出来的
前端·后端·aigc
用户3076752811271 小时前
💡 从"傻等"到"流淌":我在AI项目中实现流式输出的血泪史(附真实代码+深度解析)
前端
bluceli2 小时前
前端性能优化实战指南:让你的网页飞起来
前端·性能优化
SuperEugene2 小时前
Vue状态管理扫盲篇:如何设计一个合理的全局状态树 | 用户、权限、字典、布局配置
前端·vue.js·面试