![](/img/trans.png)
[英]error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
[英]error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. Is it missing an @NgModule annotation?
我在我的超級簡單 Angular 應用程序中收到此錯誤,我不知道為什么會收到此錯誤。 我提供了一個屏幕截圖,可以回答您可能遇到的大多數問題。
error NG6002: Appears in the NgModule.imports of AppModule, but could not be
resolved to an NgModule class.
Is it missing an @NgModule annotation?
注意:當我第一次生成 ChannelService class 時,它正在編譯,但在我擺弄它后停止工作。 我嘗試了一些顯而易見的事情,比如刪除node_modules
和重建。
您的模塊導入中有一個服務,它是一個提供者,應該自動注冊,因為它providedIn: 'root'
@NgModule({
declarations: [
AppComponent
],
imports: [
HttpClientModule,
ChannelService, // <-- remove this
BrowserModule,
AgGridModule.withComponents([])
],
providers: [],
bootstrap: [AppComponent]
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.