Deepak Preman
Deepak Preman

Reputation: 113

ERROR in : Cannot determine the module for class SomeComponent in /path to that component.ts! Add SomeComponent to the NgModule to fix it

I have angular 6 / node js system which is already in live. So now i need to move the latest changes to live server and before that to dev server. Both are same environment that is Linux Server (RHEL7.6) and am in working windows.

So am getting this error when am doing ng build --prod in dev server but ng serve will work and ng build will work, and am not getting this error in my local machine which is windows. I googled and found some case sensitive can be a reason for this but i double checked and am 100% sure that is not a reason here. And also i refereed this page Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2 but that also does not helping me. The issue is happening only for the components that already exits, i just changed location of that components and one components name. And i moved all the changes through winSCP to dev server. Any help is appreciated.

Upvotes: 1

Views: 306

Answers (1)

Deepak Preman
Deepak Preman

Reputation: 113

This issue was because when i changed location of a component in local and moved whole folder to dev server using winscp, in dev the component will exits in new location and also it will be there in old location as it will not be deleting files when you move folder like that using winscp. So there will be component with same name in different location and that was the reason for this issue

Note :- There was no import code for this duplicate entry from old location in my app.module.ts (Angular Code where we import components) file still this issue occurred i don't know how and why.

Deleted files from old location and tried ng build --prod and it worked.

Upvotes: 1

Related Questions