我有一个 Angular 8 项目,当我启用 Angular Ivy 时,它在编译期间会失败。当我检查其他人提供的解决方案并更新到角度 8.1.0(从 8.0.3 开始)但问题仍然存在并不断给我以下错误:
D:\Users\Backup>ng build shared
Building Angular Package
Building entry point 'shared'
Compiling TypeScript sources through ngc
BUILD ERROR
node_modules/@angular/common/common.d.ts(115,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class
node_modules/@angular/forms/forms.d.ts(2669,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class
node_modules/@angular/forms/forms.d.ts(3703,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class
node_modules/@angular/common/http/http.d.ts(2799,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class
我的 Angular Ivy 在 tsconfig.app.json 中启用。
"angularCompilerOptions": {
"enableIvy": true
}
我的 package.json 具有以下依赖项:
"dependencies": {
"@angular/animations": "~8.0.3",
"@angular/common": "~8.0.3",
"@angular/compiler": "~8.0.3",
"@angular/core": "~8.0.3",
"@angular/forms": "~8.0.3",
"@angular/material": "^8.0.1",
"@angular/platform-browser": "~8.0.3",
"@angular/platform-browser-dynamic": "~8.0.3",
"@angular/platform-server": "~8.0.3",
"@angular/router": "~8.0.3",
"@ng-bootstrap/ng-bootstrap": "^5.0.0-rc.0",
"@nguniversal/express-engine": "^7.1.1",
"@nguniversal/module-map-ngfactory-loader": "0.0.0",
"@nicky-lenaers/ngx-scroll-to": "^2.0.0",
"@swimlane/ngx-charts": "^11.1.0",
"@types/googlemaps": "^3.36.5",
"core-js": "^2.5.4",
"express": "^4.15.2",
"ngx-cookie-service": "^2.2.0",
"ngx-typeahead": "^6.2.0",
"rxjs": "~6.5.2",
"systemjs": "3.0.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.6",
"@angular-devkit/build-ng-packagr": "~0.800.6",
"@angular/cli": "~8.0.6",
"@angular/compiler-cli": "~8.0.3",
"@angular/language-service": "~8.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine": "^3.3.1",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"ng-packagr": "^5.1.0",
"prettier": "^1.16.4",
"tsickle": ">=0.34.0",
"ts-loader": "^5.2.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.4.5",
"webpack-cli": "^3.1.0"
}
请帮助我解决上述问题。