[英]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.