[Fixed] Cant find Module error in Angular when following the steps from angular.io

Issue

This is my first Angular App which I am building from angular.io documentation. I have followed the same steps as they have mentioned and I see that when I generate new components they are not getting added to app.module so I tried added them and here I am getting the following error

Cannot find module ‘./product-alerts/product-alerts.component’.

This app is being built in stackblitz so please find the links for my project.

EditorURl: https://stackblitz.com/edit/angular-tejatest1

Solution

It’s because your product-alerts component is outside of app folder. Change your import in module like this: Or move your product-alerts inside app folder.

Try this:

app.module.ts

import { ProductAlertsComponent } from '../product-alerts/product-alerts.component';

Leave a Reply

(*) Required, Your email will not be published