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
相关推荐
Z兽兽4 小时前
React@18+Vite项目配置env文件
前端·react.js·前端框架
SuniaWang4 小时前
《Spring AI + 大模型全栈实战》学习手册系列 · 专题六:《Vue3 前端开发实战:打造企业级 RAG 问答界面》
java·前端·人工智能·spring boot·后端·spring·架构
A_nanda5 小时前
根据AI提示排查vue前端项目
前端·javascript·vue.js
happymaker06266 小时前
web前端学习日记——DAY05(定位、浮动、视频音频播放)
前端·学习·音视频
~无忧花开~6 小时前
React状态管理完全指南
开发语言·前端·javascript·react.js·前端框架
LegendNoTitle6 小时前
计算机三级等级考试 网络技术 选择题考点详细梳理
服务器·前端·经验分享·笔记·php
@大迁世界6 小时前
1.什么是 ReactJS?
前端·javascript·react.js·前端框架·ecmascript
BJ-Giser7 小时前
Cesium 基于EZ-Tree的植被效果
前端·可视化·cesium
王码码20358 小时前
Flutter for OpenHarmony:Flutter 三方库 algoliasearch 毫秒级云端搜索体验(云原生搜索引擎)
android·前端·git·flutter·搜索引擎·云原生·harmonyos
发现一只大呆瓜8 小时前
深入浅出 AST:解密 Vite、Babel编译的底层“黑盒”
前端·面试·vite