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

使用@nativescript-community/ui-drawer时Angular报ɵsetClassDebugInfo未找到错误

解决@nativescript-community/ui-drawer在Angular 16中ɵsetClassDebugInfo未找到的错误

问题原因

你遇到的错误是因为Angular 16移除了内部调试API ɵsetClassDebugInfo,而当前使用的@nativescript-community/ui-drawer包版本过旧,仍在调用这个已废弃的API。

解决方案

1. 优先升级包(推荐)

检查@nativescript-community/ui-drawer是否有适配Angular 16的更新版本,执行以下命令升级:

npm update @nativescript-community/ui-drawer

如果升级后仍有问题,可查看包的版本日志,指定安装兼容Angular 16的具体版本。

2. 临时修改依赖代码(应急方案)

如果暂时无法升级包,可手动修改node_modules中的报错文件(注意:该修改会在重新安装依赖后失效):

找到报错文件:./node_modules/@nativescript-community/ui-drawer/angular/fesm2022/nativescript-community-ui-drawer-angular.mjs,定位到第58行的代码:

(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DrawerComponent, { className: "DrawerComponent", filePath: "module.ts", lineNumber: 26 }); })();

将其替换为以下任意一种写法:

写法一:直接移除调试逻辑

(() => {})();

写法二:保留调试模式判断(无实际操作)

(() => { if (typeof ngDevMode !== "undefined" && ngDevMode) { /* Angular 16已移除ɵsetClassDebugInfo,调试信息由框架自动处理 */ } })();

说明

ɵsetClassDebugInfo是Angular早期用于手动设置组件调试元信息的内部API,在Angular 16及以后的版本中已被移除,现代Angular框架会自动处理组件的调试信息,无需手动调用该API。

内容的提问来源于stack exchange,提问作者Alex-1999

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 15:42:37