直到昨天,一切都很好。使用cmd,我输入ng serve,转到浏览器中输入localhost:4200,然后我的网站启动。 今天突然,本地主机没有响应。 ng服务正常工作。
输入ng-serve-
后的输出10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 47.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.7 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.81 MB [initial] [rendered]
Date: 2019-09-05T04:20:41.402Z - Hash: a7331d4e748902ef88b7 - Time: 19033ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
我尝试使用其他浏览器,尝试重新安装angular,但问题仍然存在。
我在浏览器中收到的消息是-无法访问此网站。
答案 0 :(得分:0)
您可以尝试更改主机和端口,如下所示:
ng serve --host 0.0.0.0 --port 5000
也许会有所帮助...
答案 1 :(得分:0)
好,我发现了问题。 Windows Update之后,防火墙设置被弄乱了。我恢复了默认设置,现在可以正常工作了。 故事的寓意:使用Linux!
答案 2 :(得分:0)
在每次进行首次编译之前启动您的应用程序。
步骤。
ng serve
并等待。localhost:4200