繁体   English   中英

:4200//assets/config.json:1 加载资源失败:服务器响应状态为404(未找到)

[英]:4200//assets/config.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)

使用VS代码angular 14

项目从 angular 8 更新

ng build 和 ng serve 工作正常。

但是 http://localhost:4200/ 给出这个错误:加载资源失败:服务器响应状态为 404(未找到):4200//assets/config.json:1

我被困在这里。

在此处输入图像描述

在此处输入图像描述

在文件 configuration.service.ts 中有这个

private get configurationUrl(): string { const path = (environment.configurationPath.startsWith('/')?'': '/') + environment.configurationPath; 常量 baseUrl = this.window.document.baseURI; 返回 ${baseUrl}${path}; }

我更改了第一行,因为它添加了一个反斜杠,因为我不知道是什么原因。 私有获取 configurationUrl(): string { const path = environment.configurationPath; 常量 baseUrl = this.window.document.baseURI; 返回 ${baseUrl}${path}; 这解决了这个问题。 所以谢谢大家的帮助,这让我想到寻找这个双反斜杠

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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