【发布时间】:2019-09-02 09:01:23
【问题描述】:
背景:我有一个使用多种语言的 Angular 网站
默认:/desktop/
英语:/en/
西班牙语:/es/
问题:我无法为 /en/ 或 /es/ 加载某些 javascript 文件,但在 /desktop/ 上运行时它们加载正常(我使用以下 SO 文章获取至此:Failed to Load。我还查看了:this thread。这似乎不同,因为它不仅仅是一个站点配置指向错误的文件夹,我有多个站点(语言)
详细信息:我的“桌面”批处理文件包含以下内容:
cd program-Desktop
call ng serve --base-href "/desktop/" --deploy-url "/desktop" --configuration=local-en
对于“en”站点批处理文件,我试过了:
call ng serve --base-href "/en/" --deploy-url "/desktop" --configuration=local-en
和
call ng serve --base-href "/en/" --deploy-url "/en" --configuration=local-en
实际结果:但是我仍然收到如下错误:
获取http://localhost:4200/desktop/assets/js/Scripts/jquery-2.1.1.js
net::ERR_ABORTED 404(未找到)
注意:这在 REL 和 PROD 中运行良好。但是在本地遇到麻烦
问题:我不知道为什么当我告诉它 /en 时它仍在 /desktop 中查找。 如果我去 /en/ 的地址我可以看到那里的 js 文件,那为什么还在 /desktop 中寻找它呢?
【问题讨论】:
标签: angular angular-cli http-status-code-404 href