简体   繁体   English

ng build --prod无法确定X类的模块! 将ThreadListTabsComponent添加到NgModule以修复它

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

I'm trying to build my Angular 5 app, and I'm getting the error: 我正在尝试构建我的Angular 5应用程序,我收到错误:

Cannot determine the module for class ThreadListTabsComponent in /home/brightwater/Differ/src/app/thread-lists/thread-lists.component.ts! 无法在/home/brightwater/Differ/src/app/thread-lists/thread-lists.component.ts中确定类ThreadListTabsComponent的模块! Add ThreadListTabsComponent to the NgModule to fix it. 将ThreadListTabsComponent添加到NgModule以修复它。

This is confusing because I'm importing the offending component in the module: 这很令人困惑,因为我在模块中导入有问题的组件:

thread-lists.module.ts : thread-lists.module.ts

import { OtherModules } from './modules-everywhere';
import { NgModule }      from '@angular/core'

import { SomeOtherComponents }  from './other-components.component';
import { ThreadListTabsComponent } from './thread-list-tabs.component';

@NgModule({
  imports: 
  [ 
    OtherModules
  ],
  declarations: [
    OtherComponents,
    ThreadListTabsComponent
  ],
  exports: [
    OtherComponents,
    ThreadListTabsComponent
  ],
  providers: [ ThreadListsService ]
})


export class ThreadListsModule { }

Here's the component: 这是组件:

thread-list-tabs.component.ts 线程列表tabs.component.ts

import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Router }   from '@angular/router';
import { ThreadListsService }   from './thread-lists.service';

@Component({
  moduleId: module.id,
  selector: 'thread-list-tabs',
  templateUrl: 'thread-list-tabs.component.html',
  styleUrls: ['thread-list-tabs.component.css']
})


export class ThreadListTabsComponent {

  // Stuff this component does

}

app.module.ts app.module.ts

import { NgModule } from '@angular/core'
import { ThreadListsModule } from './thread-lists/thread-lists.module'
import { OtherModules } from './other.modules'
import { AppComponent } from './app.component'

@NgModule({
  imports: [    
    OtherModules, 
    ThreadListsModule
  ],
  declarations: [ 
    AppComponent
  ],
  providers: [ SomeService ],
  bootstrap: [ AppComponent ]
})

export class AppModule { }

Is there something I'm missing? 有什么我想念的吗?

This looks like a filename casing problem. 这看起来像文件名大小写问题。 see github.com/angular/angular-cli/issues/10732 见github.com/angular/angular-cli/issues/10732

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular:ng build --prod“无法确定类的模块。 将类添加到NgModule以修复它“ - Angular: ng build --prod “Cannot determine the module for class. Add class to the NgModule to fix it” Angular 7-生产构建错误-无法确定X类组件的模块! 将X组件添加到NgModule中进行修复 - Angular 7 - Production Build Error - Cannot determine the module for class X Component! Add X Component to the NgModule to fix it 无法确定用于类的模块-ng build --prod - Cannot determine the module for class - ng build --prod 无法确定 X.ts 中 class X 的模块! 将 X 添加到 NgModule 以修复 ionic2 中的错误 - Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2 无法确定 class Component.ts 文件中的模块,将组件添加到 NgModule 中修复它 - Cannot determine the module for class Component in component.ts file, add component to the NgModule to fix it 无法确定模块类x位置/ x.component.ts中的组件将x组件添加到Ng模块以修复它。 Angular 4 - Can not determine the module class x Component in location/x.component.ts add x component to Ng Module to fix it. Angular 4 错误:无法确定 --prod 中类 OverlayPortal 的模块 - Error: Cannot determine the module for class OverlayPortal in --prod 没有ngModule的ng build错误 - ng build Errors with not an ngModule npm run build:prod, hatası &quot;TS2307: 找不到模块&quot;angular ng toolkit 通用 - npm run build:prod, hatası " TS2307: Cannot find module" angular ng toolkit universal 错误 NG6002:出现在 NgModule.imports 的<module> ,但无法解析为 NgModule 类 - error NG6002: Appears in the NgModule.imports of <module>, but could not be resolved to an NgModule class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM