The module for the class could not be identified during the ng build process when using the --

Encountering an error when running:

ng build --prod

However,

ng build

works without any issues.


Despite searching for solutions on Stack Overflow, none of them resolved the problem.

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

Angular `ng build --prod` issue


Error message displayed 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();
  }
}

https://i.stack.imgur.com/ckcvR.png

Answer №1

Could you confirm whether ModelComponent is located within a module and ensure that the module is imported in your AppModule?

The next action to take is to simplify the scenario and share additional code examples (such as HTML snippet where the component is used, AppModule configuration, feature module setup, and component TypeScript file).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Positioning Backgrounds with Padding in DIV Elements

I am trying to figure out how to add a check mark next to text in a button with specific styling. I have managed to get the check mark aligned properly using Background:left center, but I also want to add padding and adjust spacing. Is there a way to achie ...

Angular routing template failing to execute inline JavaScript code

I'm facing an issue with my Angular.js routing implementation. I have successfully displayed the HTML code in templates using angular.js, but now I am encountering a problem with my template structure: <div id="map_canvas" style="width:95%; heigh ...

Leveraging Angular's capability to import files directly from the assets

I recently installed a library via npm and made some modifications to one of the modules. python.js If I delete the node_modules folder and run npm install, I am concerned that I will lose my changes. Is there a way to preserve these modifications by mov ...

Using values from a select menu in a math calculation without including a decimal point

I am working with a dropdown menu that contains various values... <select id="number1a" onChange="Addition()"> <option value="0" selected>-</option> <option value="10">10</option> <option value="7.5">7.5</optio ...

What is the best way to define these variables at a global scope within my controller?

In my controller (NodeJS/Express), I have 10 routes that all use the same variables 'startDate' and 'endDate'. Is there a way to declare these globally so they don't need to be repeated in each route? Currently, my code checks if ...

Toggle the div if the if statement is true; otherwise, hide the broken

click: function(event, data) { $('#clicked-state') .text('You clicked: '+data.name); if (data.name == "VA") { $('#va').toggle(); } else { $('#va').style.d ...

Exporting a named export for every HTTP method is the way to go with NextJs

I'm currently working on a project to create an Airbnb clone using NextJs. The tutorial I'm following is using an experimental version, while I've opted for the latest version of NextJs. One aspect that's been causing confusion for me i ...

Accessing JSON fields containing accents in JavaScript

I am encountering an issue with the JSON file below: { "foo supé": 10 } My attempt is to extract and log the value of the field "foo supé" into the console using the code snippet provided: <!DOCTYPE html> <html> <s ...

What could be causing ng-repeat to malfunction?

My ng-repeat is not working with the table - only the header part is being displayed in the output. I have checked my binding and it seems to be correct, but I know I am missing something. Can someone please help me figure out what I am doing wrong? JAVA ...

Having trouble with protractor's sendKeys function when trying to interact with md-contact-chips

Does anyone know how to set a value using sendKeys in Protractor for md-contact-chips? I attempted to use element(by.model('skills')).sendKeys('Java'); but it doesn't seem to be working. Any suggestions on how to approach this in ...

What is the best way to target and manipulate the transform property of multiple div elements in JavaScript?

Looking at this code snippet, my goal is to have all the boxes rotate 180deg with a single click, without needing to apply different ID names: function rotateAllBoxes() { var boxes = document.getElementsByClassName("box"); for (var i = 0; i < box ...

Trigger the UseEffect() function in a Material UI Dialog only when the dialog is open

In my project, I have a parent component that includes a Material UI Dialog as a child component. The purpose of this dialog is to fetch and display data from a REST API. Currently, I am using the UseEffect() function in the Dialog component to achieve th ...

Use javascript to modify a specific section of a link

I have a set of datatable rows with links that contain data, and I need to modify part of the link text. For instance, if the link is 200.0.0.10, I want to change it to 160.11.10.12. Despite attempting the following code, the link does not change: var ...

Exploring the Method of Utilizing JSON Attribute in typeScript

How to access JSON attributes in TypeScript while working on an Angular Project? I'm currently in the process of building an Angular project and I need to know how to access JSON attributes within TypeScript. test:string; response:any; w ...

When faced with the scenario of having the hashtag in the href attribute and a browser's back button, it

Hello everyone, I've encountered an issue with the "back" action in my browser. When I click on a link, it takes me to a specific page due to a JavaScript function being called. However, when I hit the back button, it simply removes the "#" from the U ...

Creating an Inner Join Query Using TypeORM's QueryBuilder: A Step-by-Step Guide

Hello there! I'm new to TypeORM and haven't had much experience with ORM. I'm finding it a bit challenging to grasp the documentation and examples available online. My main goal is to utilize the TypeORM QueryBuilder in order to create this ...

Error: To execute NPX command locally from Google Maps API documentation, make sure to call npm.load(callback) as required

Attempting to execute the Google Maps API example locally using this command: npx @googlemaps/js-samples init directions-waypoints googlemapssample However, every time I try to run the npx command locally, it fails after a short period and I encounter the ...

Determining the best method for change detection in Angular 2: Choosing between Observable, EventEmitter, and Dot Rule

Managing change detection in Angular2 can be approached in three different methods that I have observed. Utilizing Observables @Injectable() export class TodosService { todos$: Observable<Array<Todo>>; private _todosObserver: any; ...

`On the first date chosen, activate an event within the ngx-bootstrap daterangepicker.`

I am utilizing a date range picker with the following code: <bs-daterangepicker-inline [bsValue]='bsValue' (bsValueChange)="test()"></bs-daterangepicker-inline>. Is there a way to trigger an event when the first date is sel ...

Encountering invalid parameters while attempting to utilize the track.scrobble service from the Last.Fm API in a Node.js application

After successfully completing the Last.Fm authentication process following the instructions provided here, I received the session key without any issues. However, my attempts to make an authenticated POST request to the track.scrobble method of the Last.Fm ...