0

I have recently upgraded my angular project from angular 8 to angular 9, when I try to run serve command I am getting below error.

error NG8001: 'app-abcd-breadcrumb' is not a known element:

1. If 'app-abcd-breadcrumb' is an Angular component, then verify that it is part of this module.

2. If 'app-abcd-breadcrumb' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.


 error NG8001: 'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.

2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

5 <router-outlet></router-outlet>

Can anyone please help me on this ? these components are the components created by me for the project. it is not any library component

Gregoire Ducharme
  • 1,095
  • 12
  • 24
Anshul
  • 118
  • 1
  • 11
  • your components should be declared in the correct modules. Check that parent component where `` is used and the breacrumbs itself are visible to each other from modules perspective – Andrei Apr 15 '22 at 10:04
  • Did you visit this page? https://angular.io/errors/NG8001 – Anton Kochev Apr 15 '22 at 10:17
  • 1. `AppAbcdComponent` should be declared in an appropriate NgModule (#1) and exported. 2. The `AppAbcdHolderComponent` (or whatever name it has) is declared in a different NgModule (#2). 3. Module #1 has to be imported by the Module #2 – Anton Kochev Apr 15 '22 at 10:25
  • @Andrei, @ Anton Kochev It was working fine with Angular 8, but after upgrade it started giving error – Anshul Apr 15 '22 at 11:58
  • yes. we understand. The reason that we've mentioned is the most probable one. So please check that modules declarations are correct – Andrei Apr 16 '22 at 10:00
  • This was fixed by deleting my node_modules and package-lock.json and did npm install again, also i ran the angular update command again – Anshul May 16 '22 at 18:44
  • @Anshul, that seems worth posting as an answer – OutstandingBill Oct 11 '22 at 01:27
  • @OutstandingBill It was causing issue because my node version was not correct, Due to some reason i switched to older version of node (12.14) and then i was doing npm install, so was getting the error. When i moved back to node version 14.15.0 and did fresh npm install after running rm -rf node_modules package-lock.json it worked for me – Anshul Oct 19 '22 at 19:24
  • @Anshul, that sounds like the kind of situation anyone could run into. It may not have been the OP's problem, but your fix might help someone else : ) – OutstandingBill Oct 19 '22 at 21:35

1 Answers1

-1

You need to declare the component inside the module.

  • @user12923414 this was resolved, i had deleted my node_modules and package-lock.json and did npm install again – Anshul May 16 '22 at 18:43