Im using ng-zorro for my project, i get the following error after --prod. Normally doing server does not produces this error. I found out this git post https://github.com/NG-ZORRO/ng-zorro-antd/issues/3713#issuecomment-513933229 but didn`t work out for me.
main-es2015.fa929b87a49d088ae223.js:36985 ERROR NullInjectorError: StaticInjectorError(AppModule)[Overlay]:
StaticInjectorError(Platform: core)[Overlay]:
NullInjectorError: No provider for Overlay!
My package.json file
{
"name": "sporttzzmeetup",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.10",
"@angular/cdk": "~8.2.1",
"@angular/common": "~8.2.10",
"@angular/compiler": "~8.2.10",
"@angular/core": "~8.2.10",
"@angular/forms": "~8.2.10",
"@angular/platform-browser": "~8.2.10",
"@angular/platform-browser-dynamic": "~8.2.10",
"@angular/router": "~8.2.10",
"core-js": "^2.5.4",
"ng-zorro-antd": "^8.3.1",
"rxjs": "~6.5.3",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.8",
"@angular/cli": "~8.3.8",
"@angular/compiler-cli": "~8.2.10",
"@angular/language-service": "~8.2.10",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"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": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.5.3"
}
}
Imports in app.module.ts The project works properly with ng server.
@NgModule({
declarations: [
AppComponent,
CommentsComponent,
],
imports: [
FlexLayoutModule,
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
BrowserAnimationsModule,
NgZorroAntdModule
],
providers: [
GlobalService,
RouteGuardService,
{ provide: HTTP_INTERCEPTORS, useClass: HttpAuthInterceptor, multi: true },
{ provide: NZ_I18N, useValue: en_US }],
bootstrap: [AppComponent]
})
export class AppModule { }
To achieve expected result, check your ng-zorro and angular version to avoid mentioned error due to version mismatch