我的 Angular 项目编译成功,但无法在 Chrome 浏览器中运行 [已关闭]

问题描述 投票:0回答:1

enter image description here enter image description here

请帮我解决这个问题

我尝试了带有“http”和“https”的 URL,但它不起作用 https://本地主机:4200/ http://localhost:4200/

这是我的 angular.json 代码 enter image description here

javascript angular angularjs compilation angular-ui-router
1个回答
0
投票

好吧,如果您编译了代码,生成了 SPA(简单页面应用程序)并且需要 http 服务器来发布它(Apache、NGIX 等) 如果你想开发和调试代码,你必须使用 `

ng serve --port 4200

` 或您想要使用的任何端口,在控制台中(假设您使用 VSCode 进行编码)或在项目根路径的终端中(通常是 package.json 和其余配置文件) serve 是一个 agular CLI 工具,它编译和发布 html 代码(实际上几乎代码都是 JS)

© www.soinside.com 2019 - 2024. All rights reserved.