错误
node_modules / angular-datatables / src / angular-datatables.module.d.ts(8,22)中的错误:错误TS-996002:出现在AppModule的NgModule.imports中,但无法解析为NgModule类 node_modules / ng2-select2 / ng2-select2.d.ts(3,22):错误TS-996002:出现在AppModule的NgModule.imports中,但无法解析为NgModule类
NG版本
Angular CLI: 8.0.3
Node: 12.4.0
OS: win32 x64
Angular: 8.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.3
@angular-devkit/build-angular 0.800.3
@angular-devkit/build-optimizer 0.800.3
@angular-devkit/build-webpack 0.800.3
@angular-devkit/core 8.0.3
@angular-devkit/schematics 8.0.3
@angular/cli 8.0.3
@angular/http 7.2.15
@angular/pwa 0.800.3
@ngtools/webpack 8.0.3
@schematics/angular 8.0.3
@schematics/update 0.800.3 (cli-only)
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0
参考 https://angular.io/guide/ivy
Angular.json
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"aot": true,
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"angularCompilerOptions": {
"enableIvy": true
},
通过将标志设置为false有效
"angularCompilerOptions": {
"enableIvy": false
},
问题
试图删除节点模块
ng在删除配置文件中的常春藤时效果很好。
任何欢迎的建议
答案 0 :(得分:0)
我遇到了同样的问题。使用Angular9。
这可能对您不起作用,但对我却有用。
取消ng服务并以某种方式重新运行它。
我还看到了很多关于具有相同问题的人的话题,就像您说的那样,他们关闭了常春藤渲染,因为它尚未完成,因此会导致错误。
答案 1 :(得分:-1)
升级到Angular 9对我有用 ng update @ angular / cli @ 9 @ angular / core @ 9 --allow-dirty