components: bug(Angular Material): Installing Angular Material 14 under Angular 14 after update from 12.x fails: Cannot read properties of undefined (reading 'kind')
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
11 (as far as I know)
Description
See #25215 (now closed…) for reference. The issue claims that this error is caused by an upgrade from Angular 11 to 14. This is not the case. This also happens if you start a new project with Angular 12 and upgrade to 14.
I followed the update guide, but the error persists.
Reproduction
Steps to reproduce:
- Create new project with Angular 12.x
- Upgrade to Angular 13.x
- Upgrade to Angular 14.x
- Install Angular material with command
ng add @angular/material@14
- Error:
Cannot read properties of undefined (reading 'kind')
Expected Behavior
Should not cause an error. Steps to fix this should be mentioned in the update guide.
Actual Behavior
Install of Angular Material v. 14.x fails.
Environment
Angular CLI: 14.0.5
Node: 16.13.2
Package Manager: npm 8.13.2
OS: win32 x64
Angular: 14.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
@angular-devkit/architect 0.1400.5
@angular-devkit/build-angular 14.0.5
@angular-devkit/core 14.0.5
@angular-devkit/schematics 14.0.5
@angular/cdk 14.0.4
@angular/material 14.0.4
@schematics/angular 14.0.5
rxjs 6.6.7
typescript 4.6.4
- Browser(s): n/a
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 27 (2 by maintainers)
Okay I just found a workaround:
ng add @angular/material
as usualVoilà
P.S.: I believe you can then manually configure the animations module by following these instructions: https://angular.io/guide/animations#step-1-enabling-the-animations-module
Thank @FatalMerlin, I’ve tried it, but it didn’t help. What did help is adding
--skip-import
, so, if anyone stumbles upon the same problem, I hope it helps.However, those are still workarounds - I hope the Angular team figures it out soon.
I have the same issue: Cannot read properties of undefined (reading ‘kind’)
It happens when I try to use:
ng generate @angular/material:navigation <component-name>
Project dependencies
“@angular/animations”: “^14.1.3”, “@angular/cdk”: “^14.1.2”, “@angular/common”: “^14.1.3”, “@angular/compiler”: “^14.1.3”, “@angular/core”: “^14.1.3”, “@angular/forms”: “^14.1.3”, “@angular/material”: “^14.1.2”, “@angular/platform-browser”: “^14.1.3”, “@angular/platform-browser-dynamic”: “^14.1.3”, “@angular/router”: “^14.1.3”, “rxjs”: “~7.5.0”, “tslib”: “^2.3.0”, “zone.js”: “~0.11.4”
I’m having a similar problem, using Angular 14.0.5:
confirming npm i typescript@latest fixed this issue for me
It worked for me, thanks
I had this issue and fixed it by updating to the latest TypeScript version. Currently
4.8.3
. Hope this works for others.Same here. Getting this error on installing angular material, and also on calling ng g @angular/material:navigation
Angular CLI: 14.1.0 Node: 16.15.1 Package Manager: npm 8.11.0 OS: win32 x64
Angular: 14.1.0 … animations, cdk, cli, common, compiler, compiler-cli, core … forms, material, platform-browser, platform-browser-dynamic … router
Package Version
@angular-devkit/architect 0.1401.0 @angular-devkit/build-angular 14.1.0 @angular-devkit/core 14.1.0 @angular-devkit/schematics 14.1.0 @schematics/angular 14.1.0 rxjs 7.5.6 typescript 4.6.4
Same with just a new project, no upgrades needed to reproduce.