Skip to content

Can not determine the module class x Component in location/x.component.ts add xcomponent to Ng Module to fix it. Angular 4 #8062

@bisho012

Description

@bisho012

I am not on the production phase on my web ... the project is working good ... I used

ng serve --o
ng build 

and it is working great .... then I tried :-

ng build --prod

this error appeared

 Cannot determine the module for class CategoriesComponent in C:/project/src/app/Components/categories/categories.component.ts! Add CategoriesComponent to the NgModule to fix it.

I know that I made a mistake ... I made 2 components with the same name but I removed the wrong one.

and here is the code of app.Module.ts file :-

    import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule , Routes } from '@angular/router';

import { FormsModule } from '@angular/forms';
import { FlashMessagesModule } from 'angular2-flash-messages';

import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';

import { AppComponent } from './app.component';
import { OrdersComponent } from './Components/orders/orders.component';
import { ItemsComponent } from './Components/items/items.component';
import { NavbarComponent } from './Components/navbar/navbar.component';
import { LoginComponent } from './Components/login/login.component';
import { RegisterComponent } from './Components/register/register.component';

import { OrdersService } from './services/orders.service';
import { AdditemsService } from './services/additems.service';
import { AddcategoriesService } from './services/addcategories.service';
import { LoginService } from './services/login.service';
import { RegisterService } from './services/register.service';
import { AddresturantService } from './services/addresturant.service';

import { AllordersComponent } from './components/allorders/allorders.component';
import { CategoriesComponent } from './components/categories/categories.component';
import { RestaurantsComponent } from './Components/restaurants/restaurants.component';


const appRoutes: Routes = [
  {path: '', component: OrdersComponent},
  {path: 'register', component: RegisterComponent},
  {path: 'login', component: LoginComponent},
  {path: 'items', component: ItemsComponent},
  {path: 'categories', component: CategoriesComponent},
  {path: 'restaurants', component: RestaurantsComponent}
];

export const firebaseConfig = {
 
};

@NgModule({
  declarations: [
    AppComponent,
    OrdersComponent,
    ItemsComponent,
    NavbarComponent,
    LoginComponent,
    RegisterComponent,
    AllordersComponent,
    CategoriesComponent,
    RestaurantsComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    FlashMessagesModule,
    AngularFireModule.initializeApp(firebaseConfig),
    RouterModule.forRoot(appRoutes)
  ],
  providers: [
    AngularFireDatabase,
    AngularFireAuth,
    OrdersService,
    AdditemsService,
    AddcategoriesService,
    LoginService,
    RegisterService,
    AddresturantService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

I removed the component that was wrong and left the right one.
What shall I do to make the production accept these components !

any suggestions ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions