首页 > 解决方案 > 新的 Angular 8 应用程序返回 http 400

问题描述

我面临一个奇怪的错误。我正在创建新的干净的 angular 8 应用程序并成功构建代码,但尝试在 localhost:4200(或我更改为的任何端口)打开应用程序应用程序返回http 400

我添加了构建信息。卸载node js并重新安装它仍然一样

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) 49.4 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) 10.1 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
Date: 2019-10-21T10:00:41.976Z - Hash: 8acb354556900c2f8710 - Time: 9192ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.

标签: node.jsangular

解决方案


nodejs 应用程序中的 server.js 文件中可能有一些内容。您是否允许来自所有网址的请求?您需要启用跨域资源共享。


推荐阅读