1

I am getting following error while i execute

ng build --prod

But

ng build

is working fine.


I have found many solutions for the same in the stack overflow but none of them worked

ng build --prod Cannot determine the module for class X! Add ThreadListTabsComponent to the NgModule to fix it

Angular `ng build --prod` issue


See error below:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS D:\IT_INF_Hol_INFstructureSuite_Cit\Projects\CitH_UI> ng build --prod

Date: 2018-12-20T08:56:40.759Z
Hash: 89b0db73219a42cd9dc4
Time: 14183ms
chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.9868d9b237c3a48c54da.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills.85f47f0bf59079cbc23a.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} styles.898f3785f5d9ae4bd624.css (styles) 387 kB [initial] [rendered]
chunk {scripts} scripts.aa85510fa2abfcc665b6.js (scripts) 326 kB  [rendered]

ERROR in : Cannot determine the module for class ModelComponet in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/model/model-component.ts! Add ModelComponet to the NgModule to fix it.
Cannot determine the module for class FilterPipe in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Shared/Directives/DataTable/DataFilter.ts! Add FilterPipe to the NgModule to fix it.
Cannot determine the module for class HolCarouselComponent in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/Hol/carousel/Hol-carousel.component.ts! Add HolCarouselComponent to the NgModule to
fix it.
Cannot determine the module for class HolSolutions1Component in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/Hol/solutions/Hol-solution1.component.ts! Add HolSolutions1Component to the NgModule to fix it.
Cannot determine the module for class LogOnComponent in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/log-on/log-on.component.ts! Add LogOnComponent to the NgModule to fix it.
Cannot determine the module for class ManageConfigsCopy in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/manage-configs/manage-configs.component - Copy.ts! Add ManageConfigsCopy to the NgModule to fix it.Cannot determine the module for class TestComponent in D:/IT_INF_Hol_INFstructureSuite_Cit/Projects/CitH_UI/src/app/Views/test-jp/test.component.ts! Add TestComponent to the NgModule to fix it.

model-component.ts

import { Component, OnInit } from '@angular/core';
import {ModalModule} from "ngx-modal";
import { NgModule }      from '@angular/core'

@Component({
  selector: 'ngx-model',
  templateUrl: './model-component.html'
})
export class ModelComponet implements OnInit {

 // lstMenuItems:MenuEntities[];

 // constructor(private Menu_Service:MenuService,private clsmenu:MenuEntities) { }
  constructor() { }
  ngOnInit() {
   //this.loadMenu();
  }
}

enter image description here

SmartestVEGA
  • 8,415
  • 26
  • 86
  • 139

1 Answers1

3

Can you verify that ModelComponet is a) in a module and b) that the module ends up imported in your AppModule?

Next step is, break it down to a simpler example and provide more code (including HTML where the component gets loaded, appmodule, featuremodule, component.ts).

CaKa
  • 3,219
  • 3
  • 14
  • 20
  • ModelComponet is never used in app.module.ts – SmartestVEGA Dec 20 '18 at 09:11
  • Yeah please read carefully. You need to verify that ModelComponet is in some module and that this module **ends up** in the app module. – CaKa Dec 20 '18 at 09:17
  • only two placess it is been used – SmartestVEGA Dec 20 '18 at 09:29
  • 1
    just to clarify, the ModelComponent should be part of your AppModule declarations. If its not in that array, it is not being used. – enf0rcer Dec 20 '18 at 09:31
  • 1
    I'm afraid you didn't understand me. Verify that either ModelComponent is declared in your AppModule or in another module which is then imported to your app module. Read more carefully please, if you expect help. – CaKa Dec 20 '18 at 09:31