I followed each steps described here: https://material.angular.io/guide/getting-started
Error I get
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/material' in '/Users/isabelle/my-project/src/app'
@ ./src/app/app.module.ts 14:0-51
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
What I did
npm install -g @angular/cli
ng new my-project
npm install --save @angular/material
In src/app/app.module.ts
import { MaterialModule } from '@angular/material';
// other imports
@NgModule({
imports: [MaterialModule],
...
})
export class PizzaPartyAppModule { }
I did that command again and everything ran smoothly
npm install --save @angular/material
npm install --save @angular/material
npm install --save @angular/cdk
restart dev server
(usually the console will tell you when there are dependencies, pay attention to it)
Simply add it to your project
ng add @angular/material
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With