<SomeModule>不是Angular模块

fro*_*sty 1 webstorm angular

当使用Angular项目时,我正在导入核心Angular NgModules,而Webstorm告诉我它们不是有效的Angular模块。

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule, // Gets the error
        AppRoutingModule,
        SharedModule,
        HttpClientModule, // Gets the error
        UpgradeModule, // Gets the error
        CoreModule,
    ],
    providers: [],
    bootstrap: [AppComponent],
    schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

我要导入的所有模块app.module都出现红字,表示它们不是Angular模块。我不能忍受着看代码。谁看过这个吗?请帮忙。

fro*_*sty 5

我与网络风暴小组进行了一次Google Hangout,他们发现我的任何一个都没有node_modules被索引。我打开了项目首选项,并将其node_modules从排除的目录中删除。完全工作。

  • 点击Command + ,以打开“首选项”。
  • 搜索Directories你左手的偏好菜单。
  • node_modules从右侧的排除部分中删除。
  • 保存并应用更改
  • 等待Webstorm重新索引项目和节点模块。

有效。

  • 我不得不重新启动 WebStorm,因为它没有自动索引。重启后就可以工作了。 (2认同)