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

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

问题描述

我正在尝试编译我的第一个有角度的应用程序,但是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):错误:找不到[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服务无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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