当构建时,angular 5显示错误--prod

时间:2018-05-02 08:16:30

标签: angular angular5

ng build --prod期间,我发现错误发生在:

  

无法确定类AdminLoginComponent的模块   /var/www/html/ngAngular/src/app/admin-login/admin-login.component.ts!   将AdminLoginComponent添加到NgModule以修复它。

我的app.module.ts包含以下代码:

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import {ReactiveFormsModule} from '@angular/forms';
import {AdminLoginComponent} from './admin/admin-login/admin-login.component';
import {LoginComponent} from './login/login.component';
import {AppComponent} from './app.component';
import {RegisterComponent} from './register/register.component';
import {PageNotFoundComponent} from './page-not-found/page-not-found.component';

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    PageNotFoundComponent,
    RegisterComponent,
    AdminLoginComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    ReactiveFormsModule,
    AdminModule,
    AppRoutingModule
  ],
  providers: [AuthGuardService, AuthService],
  bootstrap: [AppComponent]
})
export class AppModule {
}

我需要添加到某个地方吗?

1 个答案:

答案 0 :(得分:1)

您可能有2个具有相同名称的组件。那么,您可以删除或重命名它并重试吗?