Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 13 NG0301 error does not show module giving error

Tags:

angular

Could you please assist me?

I upgraded my Angular project from v11 to v13:

Angular: 13.2.4
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.5
@angular-devkit/build-angular   13.2.5
@angular-devkit/core            13.2.5
@angular-devkit/schematics      13.2.5
@angular/cli                    13.2.5
@schematics/angular             9.1.15
rxjs                            6.6.7
typescript                      4.5.5

I was able to run my project successfully.

I then tried the following on a parent controller:

import { ChangeDetectorRef } from '@angular/core';

I then deleted that import.

I now get the following console error when I try to run my project:

ERROR Error: Uncaught (in promise): Error: NG0301
Error: NG0301
    at fO (main.js:1:57364)
    at xm (main.js:1:57397)
    at TA (main.js:1:69323)
    at l (main.js:1:69467)
    at template (main.js:1:444680)
    at N1 (main.js:1:53378)
    at Oc (main.js:1:51511)
    at wO (main.js:1:59577)
    at tO (main.js:1:51715)
    at Oc (main.js:1:51726)
    at ue (polyfills.js:1:137893)
    at ue (polyfills.js:1:137404)
    at polyfills.js:1:138755
    at S.invokeTask (polyfills.js:1:128526)
    at Object.onInvokeTask (main.js:1:105006)
    at S.invokeTask (polyfills.js:1:128447)
    at S.runTask (polyfills.js:1:123566)
    at P (polyfills.js:1:130871)

I have checked online and most NG0301 errors usually mention the module that is giving the issue. But in my case, I do not get this.

Does anybody know how to solve this issue?

like image 969
Jeremiah Avatar asked Aug 31 '26 01:08

Jeremiah


1 Answers

I was also getting same error, So resolved it by deleting cache folder in .angular.

rm .angular/cache
ng serve
like image 148
Muhammad Abdullah Avatar answered Sep 03 '26 17:09

Muhammad Abdullah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!