< SomeModule>不是Angular模块 [英] <SomeModule> is not an Angular module

查看:66
本文介绍了< SomeModule>不是Angular模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When using an Angular project, I am importing the core Angular NgModules, and Webstorm is telling me that they are not valid Angular modules.

@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 {}

我要导入到 app.module 中的所有模块都出现红字,表示它们不是Angular模块.我不能忍受看与此相关的代码.有没有人见过这个?请帮忙.

All of the modules that I am importing into my app.module are getting a red-squiggle saying that they are not an Angular module. I can't stand to look at the code with this. Has anyone seen this before? Please help.

推荐答案

我与Webstorm团队进行了Google环聊,他们发现没有对我的 node_modules 进行索引.我打开了项目首选项,并从排除的目录中删除了 node_modules .完全工作.

I got on a Google Hangout with the webstorm team and they saw that none of my node_modules were being indexed. I opened up my project preferences and removed node_modules from my excluded directories. Totally worked.

  • 点击 Command + ,以打开首选项".
  • 在左侧的偏好设置菜单中搜索目录.
  • 从右侧的排除部分中删除 node_modules .
  • 保存并应用更改
  • 等待Webstorm重新索引项目和节点模块.
  • Hit Command + , to open Preferences.
  • Search for Directories in your left preferences menu.
  • Remove node_modules from the excluded section on the right.
  • Save and Apply changes
  • Wait for Webstorm to re-index the project and node modules.

有效.

这篇关于< SomeModule>不是Angular模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆