【问题标题】:'RatingModule' does not appear to be an NgModule class\'RatingModule\' 似乎不是 NgModule 类
【发布时间】:2022-11-10 23:22:42
【问题描述】:

我正在尝试在 Angular 13 中使用 starrating 模块。安装了软件包,但每当我在 AppModule 中调用模块时总是出现以下错误:

'RatingModule' does not appear to be an NgModule class.
rating.module.d.ts(1, 22): This likely means that the library (ng-starrating) which declares 
RatingModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. 
Check if a newer version of the library is available, and update if so. Also consider checking 
with the library's authors to see if the library is expected to be compatible with Ivy.

我尝试了一些在互联网上找到的解决方案,但没有一个对我有用,有人遇到过这个错误吗?我感谢您的帮助!

【问题讨论】:

  • 尝试运行npx ngccnode ./node_modules/.bin/ngcc
  • 他们都没有工作,还有其他选择吗?
  • ng-starrating 的最后一次更新是 3 年前。你确定它仍然与 Angular v13 兼容吗?
  • 确实,我通过修改 tsconfig.app.json 文件并重新构建项目找到了一种方法,但我不确定这是否是方便的解决方案!

标签: angular


【解决方案1】:

我之前遇到过类似的情况,我通过尝试清除缓存并删除并重新安装 node_modules 来解决

此致!

【讨论】:

  • 谢谢你!我试过了,但在我的情况下没有用!
【解决方案2】:

我尝试运行npx ngcc。它对我有用。

【讨论】:

    猜你喜欢
    • 2022-11-26
    • 2020-08-20
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2021-02-15
    • 2019-07-31
    • 2023-01-12
    • 1970-01-01
    相关资源
    最近更新 更多