在“ @ angular / core” Angular v8.1.0中找不到导出“ɵɵelementHostStyling”

时间:2019-07-08 23:15:43

标签: angular npm

先决条件

我刚刚将我的应用程序更新为以下软件包

"@angular/cdk": "^8.0.2",
"@angular/common": "~8.0.3",
"@angular/compiler": "~8.0.3",
"@angular/core": "^8.1.0",
"@angular/forms": "^8.1.0",
"@angular/platform-browser-dynamic": "^8.1.0",
"@angular/platform-browser": "^8.1.0",
"@angular/router": "^8.1.0",
"@angular-devkit/build-angular": "^0.800.6",
"@angular-devkit/build-ng-packagr": "~0.800.6",
"@angular-devkit/build-optimizer": "^0.800.6",
"@angular/animations": "^8.1.0",
"@angular/cli": "^8.1.0",
"@angular/compiler-cli": "^8.1.0",
"@angular/language-service": "^8.1.0"

编译失败

我已经运行命令npm run watch,并且发生以下错误

"build-libs": "npm run build-helper-messages && npm run build-kpi-mrr && npm run build-kpi",
"watch": "npm run build-libs &&  ng serve --watch --open --ssl true"
  

./ node_modules/@angular/common/fesm2015/common.js 4031:8-28中的错误   “在'@ angular / core'中找不到导出'ɵɵelementHostStyling'

     

错误   在./node_modules/@angular/common/fesm2015/common.js 5468:8-28“导出   在'@ angular / core'中找不到'ɵɵelementHostStyling'

     

错误   ./node_modules/@angular/common/fesm2015/common.js 4035:8-33“导出   在“ @ angular / core”中找不到“ɵɵelementHostStylingApply”

     

错误   ./node_modules/@angular/common/fesm2015/common.js 5472:8-33“导出   在“ @ angular / core”中找不到“ɵɵelementHostStylingApply”

     

错误   ./node_modules/@angular/common/fesm2015/common.js 4034:8-31“导出   在“ @ angular / core”中找不到“ɵɵelementHostStylingMap”

     

错误   ./node_modules/@angular/common/fesm2015/common.js 5471:8-31“导出   在“ @ angular / core”中找不到“ɵɵelementHostStylingMap”

您是否知道如何解决此问题?

1 个答案:

答案 0 :(得分:1)

您应该更新所有角度相关性,可能问题是角度相关性之一,其中一些是最新的,其中一些仍是角度8,但不是最新的,因此运行此命令即可解决此问题:

ng update --all --force

同样在运行上述命令之前,请尝试先删除node_modules,然后删除npm install

您可能没有该库的最新版本

@angular/material 
@angular/cdk
@angular/animations 
@angular/core

这对我有用,同样,如果您有任何问题,请阅读此有问题的https://github.com/angular/angular/issues/30413