简体   繁体   English

无法编译新的 Angular 项目

[英]Failed To Compile New Angular Project

I created a new Angular project through ng new .我通过ng new创建了一个新的 Angular 项目。

But whenever i try to compile it through ng serve , it keeps showing these three errors in the terminal window.但是每当我尝试通过ng serve编译它时,它一直在终端 window 中显示这三个错误。

Error: Module not found: Error: Can't resolve 'F:/C#/CCC/src/app/app.component.css?ngResource' in '[Path]'
Error: Module not found: Error: Can't resolve 'F:\C#\CCC\node_modules\webpack-dev-server\client\index.js?protocol=auto%3A&username=&password=&hostname=0.0.0.0&port=0&pathname=%2Fng-cli-ws&logging=info&reconnect=10' in '[Path]'
Error: The loader "F:/C#/CCC/src/app/app.component.css" didn't return a string.

After trying many things, i found that the problem is in the project path (the '#' character).在尝试了很多事情之后,我发现问题出在项目路径( '#'字符)中。

I changed it to CSharp instead of C# and it worked.我将其更改为CSharp而不是C#并且它有效。

It really was the character '#' in the folder's name, after removing it, the problem was solved.确实是文件夹名称中的字符'#',删除它后,问题解决了。

It worked for me, I spent few days of searching, uninstalling and installing over and over.它对我有用,我花了几天时间一遍又一遍地搜索、卸载和安装。 downgrading Angular version and tried different ways to solve this issue and the solution is so simple like that.降级 Angular 版本并尝试了不同的方法来解决这个问题,解决方案就这么简单。 Just renamed the folder and removed that "#" symbol.刚刚重命名文件夹并删除了“#”符号。 Thank you!谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM