cannot determine the module for component angular 5

后端 未结 12 1946
太阳男子
太阳男子 2020-12-29 20:39

I\'m getting following error when I build the Angular app using \"ng build --prod\". This is working when I build with Angular 4 and getting error with Angular 5. With Angul

相关标签:
12条回答
  • 2020-12-29 21:13

    In my case, I had a pipe declared as their own class in mypipe.ts as well as in app.component.ts for some reason. I remove the one in app.component and it compiled fine.

    In the error message, check where exactly it is complaining and see if that is double code in your project.

    0 讨论(0)
  • 2020-12-29 21:17

    Check Case Sensitivity

    import { MyComponent } from "./User/my-component";
    

    In my case, the problem was that the folder user was created with U as capital in my import statement. But actually on disk it was in small case. When I renamed the folder to user (with u lower case) in my import statement also, it worked for me.

    import { MyComponent } from "./user/my-component";
    

    So check the case sensitivity, of your import path.

    0 讨论(0)
  • 2020-12-29 21:21

    for me, the problem was in case sensitive in import paths. but you must find all imports path that have problem. not only import that used in your module.

    0 讨论(0)
  • 2020-12-29 21:27
    1. Import specific component.
    2. Add component to @NgModule.
    0 讨论(0)
  • 2020-12-29 21:27

    I also faced same error only on prod build but not on dev build. I imported component.ts file in app.module.ts but didn't used in NgModule. So I removed the import, it worked fine.

    0 讨论(0)
  • 2020-12-29 21:27

    Normally this error occurred when you created a component but not imported it to any module.

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