Jan 04, 2021 1 mins

Package ‘@angular/material’ is not a dependency While upgrade angular material

Learn Python Learn Python

I'm using the following version in my Angular project. When try to upgrade angular material library, it gives me the following error. Any help?


Angular CLI: 12.0.5Node: 18.12.1Package Manager: npm 8.19.2Angular: 12.0.5Package Version---------------------------------------------------------@angular-devkit/architect 0.1200.5@angular-devkit/build-angular 12.0.5@angular-devkit/core 12.0.5@angular-devkit/schematics 12.0.5@angular/cdk 12.2.13@angular/material 12.2.13@schematics/angular 12.0.5rxjs 6.6.7typescript 4.2.4


Error: Package '@angular/material' is not a dependency.

Why is This error?

The error “Package ‘@angular/material’ is not a dependency” indicates that, while attempting to upgrade Angular Material, the specified package @angular/material is not recognized as a dependency in the current project.

To resolve this error, consider the following steps

Check Package Name: Confirm that you are using the correct package name for Angular Material, which is @angular/material.

Update Package.json: Verify that @angular/material is listed as a dependency in the project’s package.json file. If it’s not present, add it as a dependency.

Correct Upgrade Command: Ensure that the upgrade command is accurate. It should resemble:

ng update @angular/material

Update Angular CLI: Ensure that the Angular CLI is up-to-date by running:

ng update @angular/cli

Clear Package Cache: If the issue persists, clear the npm package cache by executing:

npm cache clean --force

Afterward, attempt the upgrade again.

By confirming package names, updating dependencies, and using the correct upgrade command, you can address the “Package ‘@angular/material’ is not a dependency” error.


  • Avatar

    Danielle Carline

    Posted on

    Try following steps in your case to resolve the error.

    Step 1: Remove node_module folder
    Step 2: npm i --force
    Step 3: ng update @angular/material@13 --force

Write a comment

You can use the Markdown syntax to format your comment.

  • Tags:
  • angular/material
  • angular
  • Share: