React + TS 初始化新项目报错解决方法

创建ts 类型的 react工程

npx create-react-app front-ts-app --template typescript

# npm start

> front-ts-app@0.1.0 start

> react-scripts start

(node:33884) DEP0176 DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead

(Use `node --trace-deprecation ...` to show where the warning was created)

Cannot find module 'ajv/dist/compile/codegen'

Require stack:

是因为因为 Create React App(CRA)默认使用的依赖版本太旧 ,和 ajv-keywords 不兼容。

所以我们只需要升级就好了

解决方法:

npm install ajv@latest ajv-keywords@latest

相关推荐
小小小小宇3 分钟前
AI大背景下端到端界面测试
前端
小小小小宇10 分钟前
前端端到端界面测试全解析与应用
前端
去伪存真15 分钟前
如何将没有字幕的英文视频转换成中文视频?
前端·pytorch·llm
Coisinier21 分钟前
RHCE中shell脚本基础(磁盘剩余空间监控,Web 服务状态检查,curl 访问 Web 服务并返回状态)
linux·运维·服务器·前端·nginx·操作系统
ywl47081208734 分钟前
springSecurity+jwt,简单版demo
java·前端·servlet
想吃火锅100542 分钟前
【前端手撕】promise.all
前端
lichenyang45343 分钟前
动态加载 vs 延迟加载:为什么 demo 里「延迟」看起来没效果?
前端
cypking1 小时前
从零搭建 Claude Code + Chrome MCP 浏览器自动化:前端 E2E 端到端测试完整教程(包含增量测试)
前端·chrome·自动化
Levi_J1 小时前
Vue2 升级 Vue3 项目实战
前端
前端拷贝猿1 小时前
扫码领券功能需求分析
前端