ng serve 无法编译 [英] ng serve won't compile

查看:28
本文介绍了ng serve 无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译我的第一个 Angular 应用程序,但是 ng serve 出现了这个错误:

I'm trying to get my very first angular app compiled, but ng serve spits this error:

./src/styles.scss 中的错误(./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embeddd!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.scss)模块构建失败(来自 ./node_modules/postcss-loader/src/index.js):错误:找不到'angular/material/prebuilt-themes/deeppurple-amber.css' 在 [C:\Users\juio\Desktop\MY GITHUB\conFusion\src]在 resolveModule.catch.catch (C:\Users\juio\Desktop\MY GITHUB\conFusion\node_modules\postcss-import\lib\resolve-id.js:35:13)在

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;
}

这就是导致问题的原因.如果我清空styles.scss 文件,它会编译,但如果我编写代码,则不会.我做错了什么?

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?

谢谢.

推荐答案

如果您在 桌面 上拥有它,请将其移至 D:\somefolder,同样的问题,这奏效了.

If you are having it on your Desktop, move it to D:\somefolder, had the same issue and this worked.

这篇关于ng serve 无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆