【发布时间】:2019-11-06 04:04:06
【问题描述】:
错误
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
},
通过将 flag 设置为 false 工作
"angularCompilerOptions": {
"enableIvy": false
},
问题
- 集成 Ivy 后错误重现。
试图删除节点模块
在配置文件中移除 ivy 时,ng serve 工作正常。
欢迎提出任何建议
【问题讨论】:
-
将您的组件模板和类文件添加到问题中。和 package.json 的内容,以查看您用于重现错误的库。考虑创建一个演示以及重新创建错误。
-
ivy 不稳定
-
是库引起的。如果库未正确构建和发布,则会弹出此错误。这与常春藤不稳定与否无关。这更像是常春藤需要一定的构建。
标签: angular typescript angular8 angular-ivy