プロジェクトに ng-zorro を使用していますが、--prod の後に次のエラーが表示されます。通常、サーバーを実行してもこのエラーは発生しません。この git 投稿https://github.com/NG-ZORRO/ng-zorro-antd/issues/3713#issuecomment-513933229を見つけました が、うまくいきませんでした。
main-es2015.fa929b87a49d088ae223.js:36985 ERROR NullInjectorError: StaticInjectorError(AppModule)[Overlay]:
StaticInjectorError(Platform: core)[Overlay]:
NullInjectorError: No provider for Overlay!
私のpackage.jsonファイル
{
"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"
}
}
app.module.ts のインポート プロジェクトは ng サーバーで適切に動作します。
@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 { }