简体   繁体   中英

Failed To Compile New Angular Project

I created a new Angular project through ng new .

But whenever i try to compile it through ng serve , it keeps showing these three errors in the terminal 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.

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. Just renamed the folder and removed that "#" symbol. Thank you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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