error:Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

angular2项目,之前运行还没问题,隔了几天再次运行就有这个问题了。

node_modules/ng-zorro-antd/carousel/carousel.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

在这里插入图片描述
这个错误出现了好多,就像截图里显示的,已经是第五个了。

我删除node_modules.json,又重新cnpm,但之后还是这个问题
百度后得到了这两种结果:
1、app.module.ts里引入错了
XXXComponent应该引入到declarations里,却错误的引入到 imports里
2、通过根据文档选择退出Ivy来修复此问题。
github里有人给出的临时解决方案
在这里插入图片描述

My temporary solution was to add:
"enableIvy": false,

"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"enableIvy": false, <---
"strictInjectionParameters": true
}

from my file tsconfig.json

https://github.com/angular/angular/issues/35255

我看有的人是在tsconfig.json里加这句,也有人在tsconfig.app.json里加这句。我是在tsconfig.app.json里加的,反正成功了,也就没细究区别

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值