3

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

Tejaswi Pandava
  • 486
  • 5
  • 17

3 Answers3

3

A similar issue was seen following the exact steps and the solution was IT-Crowd-like: saving the project and reloading the page!

Ricardo
  • 3,696
  • 5
  • 36
  • 50
1

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';
Chellappan வ
  • 23,645
  • 3
  • 29
  • 60
1

Sometimes this also happens when a component in Stackblitz is created, then deleted. The Imports happens to not get deleted automatically. This can lead to confusing situations.

Marvin
  • 129
  • 1
  • 13