You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 12下@fullcalendar/interaction模块及类型声明找不到错误求助

解决思路

1. 统一FullCalendar相关包版本

你的@fullcalendar/angular版本是^5.11.2,其余FullCalendar包为5.11.3,版本不一致可能引发依赖解析异常。修改package.json将所有FullCalendar包统一为同一版本:

"@fullcalendar/angular": "5.11.3",
"@fullcalendar/core": "5.11.3",
"@fullcalendar/daygrid": "5.11.3",
"@fullcalendar/interaction": "5.11.3",
"@fullcalendar/list": "5.11.3",
"@fullcalendar/timegrid": "5.11.3",

执行清理与重新安装命令:

rm -rf node_modules yarn.lock
yarn install

2. 安装缺失的preact依赖及类型

错误提示找不到preact及其类型声明,这是@fullcalendar/core的依赖项,手动安装:

yarn add preact
yarn add -D @types/preact

3. 清除Angular构建缓存

Angular缓存可能残留旧依赖数据,执行清理命令:

ng cache clean

随后重新构建项目:

ng build

4. 检查TypeScript配置

确保tsconfig.json未错误排除@fullcalendar或preact相关模块,同时确认typeRoots包含@types目录:

"typeRoots": [
  "node_modules/@types"
],
"exclude": [
  "node_modules/**/*",
  // 避免单独排除@fullcalendar或preact相关路径
]

5. 验证导入语句与缓存

确认app.module.ts中的导入格式正确(当前写法符合FullCalendar v5要求):

import interactionPlugin from '@fullcalendar/interaction';

若问题仍存在,可尝试删除node_modules/.cache目录后重新执行依赖安装。


内容的提问来源于stack exchange,提问作者Frmasda

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 16:01:07