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

相关推荐
codeGoogle1 小时前
2026 年 IM 怎么选?聊聊 4 家主流即时通讯方案的差异
android·前端·后端
C澒1 小时前
从单体到分布式:SLDS 2.0 全球物流履约网络架构演进之路
前端·分布式·架构·系统架构·教育电商·交通物流
We་ct1 小时前
LeetCode 21. 合并两个有序链表:两种经典解法详解
前端·算法·leetcode·链表·typescript
2501_941982051 小时前
Python开发:外部群消息自动回复
java·前端·数据库
墨染青竹梦悠然2 小时前
基于Django+vue的单词学习平台
前端·vue.js·后端·python·django·毕业设计·毕设
mCell2 小时前
从一个想法到可发布:我把博客接进 MCP 的完整实践
前端·node.js·mcp
Dragon Wu2 小时前
Zod 常用案例总结
前端·javascript·typescript
_pengliang2 小时前
react native expo 开发 ios经验总结
react native·react.js·ios
宇擎智脑科技2 小时前
CopilotKit for LangGraph 深度解析:构建 Agent 原生应用的前端交互框架
前端·人工智能·交互