error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

后端 未结 25 1890
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 12:43

First time using firestore and I\'m getting this error. It seems to be a problem with Ivy, from my research. I don\'t have a lot of experience modifying tsconfig.app.json, w

相关标签:
25条回答
  • 2020-12-13 13:04

    I got this error when I added the service class. I was using Angular 9 Went for several solutions, nothing helped me to resolve this issue. If U tried everything make sure u added ng module reference in core lib inside service. See Img

    0 讨论(0)
  • 2020-12-13 13:04

    Restarting your server may not work always. I have got this error when I imported MatFormFieldModule.

    In app.module.ts, I have imported MatFormField instead of MatFormFieldModule which lead to this error.

    Now change it and restart the server, Hope this answer helps you.

    0 讨论(0)
  • 2020-12-13 13:05

    I have faced the same issue in Ubuntu because the Angular app directory was having root permission. Changing the ownership to the local user solved the issue for me.

    $ sudo -i
    $ chown -R <username>:<group> <ANGULAR_APP>
    $ exit 
    $ cd <ANGULAR_APP>
    $ ng serve
    
    0 讨论(0)
  • 2020-12-13 13:06

    This issue will be fixed by adding the postinstall script below in your package.json.

    It will be run after a npm install.

    "scripts": {
       "postinstall": "ngcc"
    }
    

    Post adding the above code, run npm install

    This works for me when upgrading to Angular 9+

    0 讨论(0)
  • 2020-12-13 13:07

    This error shows when you add component declaration in imports: [] instead of declarations: [], e.g:

    declarations: [
      AppComponent,
    ],
    imports: [
      BrowserModule,
      AppRoutingModule,
      SomeComponent <-----------wrong
    ],
    
    0 讨论(0)
  • 2020-12-13 13:07

    In Your "tsconfig.app.json" Add Following Lines

    "angularCompilerOptions": { "enableIvy": false }

    Where to add? Just After Following Lines Of Code "exclude": ["src/test.ts", "src/**/*.spec.ts"],

    0 讨论(0)
提交回复
热议问题