I followed each of the suggestions here (I'm using Angular 7), but nothing worked. My app refused to acknowledge that @angular/material existed, so it showed an error on this line:
import { MatCheckboxModule } from '@angular/material';
Even though I was using the --save
parameter to add Angular Material to my project:
npm install --save @angular/material @angular/cdk
...it refused to add anything to my "package.json
" file.
I even tried deleting the package-lock.json
file, as some articles suggest that this causes problems, but this had no effect.
To fix this issue, I had to manually add these two lines to my "package.json
" file.
{
"devDependencies": {
...
"@angular/material": "~7.2.2",
"@angular/cdk": "~7.2.2",
...
What I can't tell is whether this is an issue related to using Angular 7, or if it's been around for years....