I am upgrading an inherited app from Angular 9 - 14. I am encountering a couple of types of errors that cannot be explained. These errors seem to be related to Material Modules and FormModules. I would guess that I am not importing / declaring / configuring these modules properly, but cannot understand where to begin troubleshooting.
I believe I should focus on how Angular is compiling my app and perhaps URLs are not matching (see here) but I don't know anything about ngcc/Ivy.
Errors:
ng8001
"mat-ELEMENT" is not a known element. IE:mat-icon
,mat-checkbox
,mat-tab-group
ng8002
Can't bind SOME-ATTR since it isn-t a known property of ELEMENTTS2322
Type 'Event' is not assignable to type 'string'. This happens when trying to bind with ngModel
The usual cause of these errors is not properly importing the proper modules. For instance, an error like 'mat-icon' is not a known element
is usually solved my importing MatIconModule
into the module where the offending component is declared. For errors related to ngModel
, typically importing FormsModule
will fix the problem.
Also, I have deleted my package.lock
files and my node_modules
folder before reinstalling my app. Like so:
rm -d -r node_modules
pnpm install
I am properly importing the Modules I need to. This app worked using Yarn and Angular 9. Now I am trying to compile using PNPM and Angular 14. As a disclaimer, i have no idea the difference between Yarn and PNPM - I inherited this problem and want to understand how to go forward. I have the following questions:
- does angular 14 work with PNPM? If so, how do I run it?
ng serve
?pnpm start
? - could I have an error in my modules that could be breaking the entire module, which prevents the modules from importing Material and FormsModule?
- are there any debugging details i should pay attention to, wheter in my tsconfig file or angular.json file?