Angular ERROR in Cannot determine the module for class AddUpdateUsersComponent Add AddUpdateUsersComponent to the NgModule to fix it

Updated on: November 15, 2019

When you are getting the below error, check for following steps whether you have missed anything:

Error: ERROR in Cannot determine the module for class AddUpdateUsersComponent in F:/MyWebsites/UserManagementApp/src/app/Users/add-update-users/add-update-users.component.ts! Add AddUpdateUsersComponent to the NgModule to fix it. 

Solution:

1. Check whether the component exists in the solution

2. If component exists in the solution, check for it exists in app.module.ts file in @NgModule declarations

3. If it is not exists in @NgModule declarations, add your component name to it

4. If it is already exists in the @NgModule declarations, remove it from declarations & from the import statement and re-add it again the @NgModule declarations & in the import statement

4. Now execute following command in the command prompt or in Terminal of Visual Studio Code to check whether it builds properly: 

ng build   
OR   
ng build --prod

5. Now, you will find that error will get removed