i'm trying to import angular material theming in the styles.scss file, But when i run ng serve, it throws the "Can't find stylesheet to import." Error.
Below is my import
@import '@angular/material/theming';
enter image description here I'm currently using Angular cli 17.
I've tried importing using the @use, but the error was the same. And i tried to change the path of the import to the node_module/@angular/material/theming.
Here is how I solved it. In your global stylesheet, like styles.scss
:
@use '@angular/material' as mat;
, and it is before all @include
statements.@import '@angular/material/theming';
@include mat-core;
with @include mat.core;
@include mat.all-legacy-component-themes($the-theme-you-use);
with
@include mat.all-component-themes($the-theme-you-use);
Make sure that $the-theme-you-use
exists.