无法确定用于类的模块-ng build --prod

时间:2018-12-20 09:07:01

标签: javascript jquery angular typescript

执行时出现以下错误

  

ng build --prod

但是

  

ng构建

工作正常。


我在堆栈溢出中发现了许多解决方案,但没有一个起作用

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

Angular `ng build --prod` issue


请参见以下错误:

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

1 个答案:

答案 0 :(得分:1)

您能否验证ModelComponet是a)在模块中,并且b)该模块最终导入了您的AppModule中?

下一步是将其分解为一个更简单的示例,并提供更多代码(包括加载组件的HTML,appmodule,featuremodule,component.ts)。