Angular实时开发服务器无法为新项目提供服务。
创始人
2024-10-29 12:00:40
0
  1. 首先,确保您的 Angular CLI 是最新版本。在终端中使用以下命令升级:
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
  1. 创建一个新的 Angular 项目:
ng new my-project
cd my-project
  1. 启动开发服务器:
ng serve
  1. 如果您看到以下错误:
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
Date: 2018-03-08T10:08:50.399Z
Hash: 5be9f283582e8993d9bf
Time: 6575ms
chunk {main} main.bundle.js, main.bundle.js.map (main) 16.2 kB {inline} [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 223 kB {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 10.4 kB {inline} [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.9 MB [initial] [rendered]
ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve 'C:\src\styles.css' in 'C:\my-project\src'
 @ multi ./src/styles.css
webpack: Failed to compile.

这意味着开发服务器无法找到 styles.css。您可以手动创建此文件并添加样式,也可以使用 Angular CLI 自动创建:

ng generate component  --style=css

这将在 src/app 中创建一个新组件,并将 styles.css 添加到该组件的目录中。

  1. 现在重新启动开发服务器,您应该能够在浏览器中访问该项目了:
ng serve

相关内容

热门资讯

透视阶段!悦扑克脚本,poke... 透视阶段!悦扑克脚本,pokemmo脚本手机版(透视)总是有脚本工具(哔哩哔哩)1、pokemmo脚...
透视步骤!wepoker辅助器... 透视步骤!wepoker辅助器软件下载,购买的wpk辅助在哪里下载(透视)其实存在有挂(哔哩哔哩)1...
透视步骤!聚星ai辅助工具激活... 透视步骤!聚星ai辅助工具激活码,poker辅助器免费安装(透视)一直是真的挂(哔哩哔哩)1、透视步...
透视经验!wpk有辅助器吗,w... 透视经验!wpk有辅助器吗,wepoker免费脚本(透视)总是是真的挂(哔哩哔哩)一、wepoker...
透视绝活儿!wpk辅助是什么,... 透视绝活儿!wpk辅助是什么,wpk透视插件(透视)一直是真的脚本脚本(哔哩哔哩)1)wpk辅助是什...
透视积累!wepoker高级辅... 透视积累!wepoker高级辅助,大菠萝手游辅助(透视)切实真的有挂(哔哩哔哩)1、每一步都需要思考...
透视烘培!wepokerplu... 透视烘培!wepokerplus透视脚本免费,德州圈脚本(透视)真是存在有挂(哔哩哔哩)透视烘培!w...
透视阶段!wepokerh5破... 透视阶段!wepokerh5破解,wepoker永久免费脚本(透视)总是真的是有挂(哔哩哔哩)1、任...
透视课程!wepoker钻石怎... 透视课程!wepoker钻石怎么看底牌,wepoker有透视吗(透视)一贯真的是有透视神器(哔哩哔哩...
透视总结!pokemmo辅助官... 透视总结!pokemmo辅助官网,wepoker私人局可以透视(透视)本来是有挂(哔哩哔哩)1、we...