NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

StaticInjectorError(Platform: core)[CdkConnectedOverlay -> Overlay]: #1703

Closed alankivi closed 6 years ago

alankivi commented 6 years ago

i upgrade from v0.7 and If I run "ng build", the application works just fine. but when I run "ng build --aot" it will be happen below error:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[CdkConnectedOverlay -> Overlay]: 
  StaticInjectorError(Platform: core)[CdkConnectedOverlay -> Overlay]: 
    NullInjectorError: No provider for Overlay!
Error: StaticInjectorError(AppModule)[CdkConnectedOverlay -> Overlay]: 
  StaticInjectorError(Platform: core)[CdkConnectedOverlay -> Overlay]: 
    NullInjectorError: No provider for Overlay!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:936)
    at resolveToken (core.js:1175)
    at tryResolveToken (core.js:1120)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1015)
    at resolveToken (core.js:1175)
    at tryResolveToken (core.js:1120)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1015)
    at resolveNgModuleDep (core.js:8065)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:8753)
    at resolveDep (core.js:9118)
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:936)
    at resolveToken (core.js:1175)
    at tryResolveToken (core.js:1120)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1015)
    at resolveToken (core.js:1175)
    at tryResolveToken (core.js:1120)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1015)
    at resolveNgModuleDep (core.js:8065)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:8753)

it is my dependencies:

"dependencies": {
    "@angular/animations": "6.0.6",
    "@angular/cdk": "^6.3.0",
    "@angular/common": "6.0.6",
    "@angular/compiler": "6.0.6",
    "@angular/core": "6.0.6",
    "@angular/forms": "6.0.6",
    "@angular/http": "6.0.6",
    "@angular/material": "^6.3.0",
    "@angular/platform-browser": "6.0.6",
    "@angular/platform-browser-dynamic": "6.0.6",
    "@angular/router": "6.0.6",
    "@types/echarts": "0.0.12",
    "core-js": "^2.5.4",
    "echarts": "^4.1.0",
    "file-saver": "^1.3.8",
    "ng-zorro-antd": "^1.0.0",
    "ngx-echarts": "^3.1.0",
    "rxjs": "^6.0.0",
    "xlsx": "^0.12.12",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "6.0.8",
    "@angular/compiler-cli": "6.0.6",
    "@angular/language-service": "6.0.6",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "2.7.2",
    "@angular-devkit/build-angular": "~0.6.8"
  }
ng-zorro-bot commented 6 years ago

Hello @alankivi, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

vthinkxie commented 6 years ago

make sure your @angular/cdk version is correct.

tempurai commented 5 years ago

make sure your @angular/cdk version is correct.

@vthinkxie Hi, I am trying to upgrade to angular 7 and using @angular/cdk & @angular/material 7.2.0 version, but got this error when build with aot

I tried to import OverlayModule, change @angular/cdk & @angular/material to 7.3.1, but still not work.

Is there any walk around?

deepthan commented 5 years ago

any help?

deepthan commented 5 years ago

hi, I got a solution, if you use ng-zorro-antd, you can try it with the following versions:

 "dependencies": {
    "@angular/animations": "~7.0.0",
    "@angular/common": "~7.0.0",
    "@angular/compiler": "~7.0.0",
    "@angular/core": "~7.0.0",
    "@angular/forms": "~7.0.0",
    "@angular/http": "~7.0.0",
    "@angular/platform-browser": "~7.0.0",
    "@angular/platform-browser-dynamic": "~7.0.0",
    "@angular/router": "~7.0.0",
    "core-js": "^2.6.3",
    "ng-zorro-antd": "^7.0.3",
    "zone.js": "~0.8.29"
 },
 "devDependencies": {
    "@angular-devkit/build-angular": "0.12.3",
    "@angular/cli": "~7.3.6",
    "@angular/compiler-cli": "^7.2.9",
    "@angular/language-service": "^7.2.9",
    "@angularclass/hmr": "^2.1.3",
    "@types/jasmine": "~3.3.12",
    "@types/jasminewd2": "~2.0.6",
    "@types/node": "~11.11.4",
    "codelyzer": "~5.0.0-beta.1",
    "jasmine-core": "~3.3.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.5",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.2",
    "ts-node": "~8.0.3",
    "tslint": "~5.14.0",
    "typescript": "3.2.4"
  }