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
相关推荐
FRing038 小时前
vue3干货总结3(defineOptions(Vue3.3)、defineModel(Vue3.4)、Pinia)
开发语言·前端·vue.js·vue3
Bczheng18 小时前
组件化服务端渲染模式SSR
前端
whitelbwwww9 小时前
CUDA C++实战--中级
开发语言·前端·c++
张紫娃9 小时前
Chrome插件-Stylus(屏蔽博客广告)
前端·chrome·stylus
Yannik9 小时前
在 Apple Silicon Mac 上用 Jenkins + Fastlane 搭建 iOS CI:从自动打包到 MR 检查流水线的完整实践
前端
Nayana9 小时前
《Web 到 HarmonyOS》-- 打包:Vite 产物 → HAP / HAR / HSP
前端
inksci10 小时前
用飞帆做了个小网页
前端·javascript·css·html
去伪存真10 小时前
被 pnpm 打包坑惨后,我彻底盘明白了硬链接与软链接
前端·electron
zhensherlock10 小时前
Protocol Launcher 系列:CodeHub 移动端 GitHub 协作利器
前端·javascript·typescript·node.js·自动化·github·js
tryCbest15 小时前
Vue3——第 22 篇:Pinia——新一代状态管理(上)
前端·javascript·vue.js