ng serve won't compile

心不动则不痛 提交于 2021-02-11 04:57:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!