简体   繁体   中英

Angular TypeError: Cannot read property 'selectors' of null After Upgrading to Angular v9

I recently upgraded my Angular app from v7 to v8, and then v8 to v9. Locally it works perfectly if I run ng serve . But when I run a production build, ng build --prod , and deploy the app I get an error in the console of the application:

类型错误:无法读取 null 的属性“选择器”

I can't find anything helpful to solve the issue. I did find a couple other people who had this issue, but no solutions. Any ideas would be greatly appreciated.

Please, check your "@angular/core" version and your "angular-devkit/build-angular" version.In my case they were in a different version, and after i fix that it works for me.

Angular 11:

"dependencies": {
    "@angular/animations": "11.2.5",
    "@angular/cdk": "11.2.5",
    "@angular/common": "11.2.5",
    "@angular/compiler": "11.2.5",
    "@angular/core": "11.2.5",
    "@angular/forms": "11.2.5",
    "@angular/material": "11.2.5",
    "@angular/platform-browser": "11.2.5",
    "@angular/platform-browser-dynamic": "11.2.5",
    "@angular/router": "11.2.5",
    ......

 "devDependencies": {
    "@angular-devkit/build-angular": "0.1102.5",
    "@angular/cli": "11.2.5",
    "@angular/compiler-cli": "11.2.5",
    "@angular/language-service": "11.2.5",
    "@types/file-saver": "^2.0.1",
    "@types/jasmine": "~3.6.0",
    ....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM