问题
I'm trying to get my very first angular app compiled, but ng serve spits this error:
ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/ang ular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embe dded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.scss) Module build failed (from ./node_modules/postcss-loader/src/index.js): Error: Failed to find 'angular/material/prebuilt-themes/deeppurple-amber.css' in [ C:\Users\juio\Desktop\MY GITHUB\conFusion\src ] at resolveModule.catch.catch (C:\Users\juio\Desktop\MY GITHUB\conFusion\node _modules\postcss-import\lib\resolve-id.js:35:13) at
I've tried some of the possible answers I've seen on internet but haven't had luck.
@import "~angular/material/prebuilt-themes/deeppurple-amber.css";
body {
padding: 0;
margin: 0;
}
This is what is causing the problem. If I empty the styles.scss file it compiles but if I write code It won't. What am I doing wrong?
Thanks.
回答1:
If you are having it on your Desktop, move it to D:\somefolder, had the same issue and this worked.
回答2:
Try changing the import path
@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css";
来源:https://stackoverflow.com/questions/53076149/ng-serve-wont-compile