Angular Material won't install with ng add

Viewed 1235

When I use the command ng add @angular/material as instructed on the Angular Material setup guide, It doesn't appear to have installed. I try to use the material components in app.module, but I get an error. Furthermore, the package doesn't show to be listed in the package.json file. I'm not sure what could be wrong. I get the following after adding ng add...

$ ng add @angular/material

  • Determining package manager... i Using package manager: npm
  • Searching for compatible package version... √ Found compatible package version: @angular/material@12.1.2.
  • Loading package information from registry... √ Package information loaded. Command aborted.

Additionally, I'm also not prompted to select a theme, typography, etc.

I also have Angular 12 install if that's what's making a difference.

2 Answers
npm install --save @angular/material @angular/cdk
ng add @angular/material

Try this commmand

ng add @angular/material@latest

This command worked for me.

Related