'Error 'Could not find project "@angular/material"' when executing the command 'npx nx add @angular/material'

I'm unable to add @angular/material to my Nx workspace. I get the error "Could not find project "@angular/material". A similar error occurs when I try to add @ngrx/store as well.

I'm executing the following commands from the root of the workspace

npx nx add @angular/material
npx nx add @ngrx/store


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source