1

When i tried to compile the app, it threw this error:

ERROR in src/app/app.module.ts(15,5): error TS2304: Cannot find name 'MatToolbarModule'. src/app/app.module.ts(16,5): error TS2304: Cannot find name 'MatSidenavModule'. src/app/app.module.ts(17,5): error TS2304: Cannot find name 'MatButtonModule'. src/app/app.module.ts(18,5): error TS2304: Cannot find name 'MatIconModule'. src/app/app.module.ts(19,5): error TS2304: Cannot find name 'MatListModule'. src/app/app.module.ts(20,5): error TS2304: Cannot find name 'MatMenuModule'. src/app/app.module.ts(21,5): error TS2304: Cannot find name 'AuthModule'. src/app/app.module.ts(22,5): error TS2304: Cannot find name 'AppRoutingModule'. src/app/app.module.ts(24,5): error TS2304: Cannot find name 'MatGridListModule'. src/app/app.module.ts(25,5): error TS2304: Cannot find name 'FlexLayoutModule'.

When I try to add material to project by ng add @angular/material it shows me this:

Package "@angular/material" was found but does not support schematics.

Does anyone find a solution for this?

4 Answers4

3

I could easily add Material 6.0 to both of my projects (recently updated to Angular 6). I had to update Angular CLI as well (locally and globally) though. After you added the Material package with ng add @angular/material, try npm install once again. It should be okay.

fame
  • 135
  • 1
  • 9
2

After upgrading to angular cli,

run the following command to uninstall @angular/material

npm uninstall @angular/material

After this run the command

ng add @angular/material

This will solve the issue.

Anil
  • 1,748
  • 8
  • 32
  • 67
0

Package "@angular/material" was found but does not support schematics.

This basically means Angular Material does not support ng add, you'd have to wait for the newer version where schematics are implemented.

If you have an old version of it, then you can use ng update @angular/material using the latest CLI. Else, just follow the official instructions: npm install --save @angular/material @angular/cdk

Joshua Chan
  • 1,797
  • 8
  • 16
  • I don't think this is the issue... I do face the same error. And when I check the [Material Angular guide](https://material.angular.io/guide/schematics), it's already available – k.vincent May 15 '18 at 12:14
  • I have to mention that I'am working on totally new project/app build on Angular 6. So it's not an issue related to upgrade and/or update. What I also noticed, is that after I did run `npm install --save @angular/material @angular/cdk`, I did run `ng add @angular/material`, then it did work and the error disappears. I can't explain it right now! – k.vincent May 15 '18 at 12:27
0

After installing material again, I got a new error, but I found the answer here: Angular 2 agm error. It was a compatibility problem with map wrapper.