You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure静态Web Apps部署报错:staticwebapp.config.json未找到

解决Azure静态Web应用部署时找不到staticwebapp.config.json的问题

问题核心原因

  1. 拼写错误:GitHub Actions配置中config_file_location写成了/asstets,正确拼写应为assets;但这不是根本问题——源码中assets文件夹实际位于src目录下,根目录不存在/assets路径。
  2. 路径指向错误:config_file_location的路径是相对于app_location(仓库根目录)的源码路径,你的staticwebapp.config.json实际在src/assets下,而非根目录的assets下。

修复步骤

1. 修正GitHub Actions配置中的路径

将config_file_location改为源码中配置文件的实际路径,同时修正拼写:

config_file_location: "/src/assets"

2. 确认构建命令有效性

确保npm run build-prod命令能正常执行Angular构建,将src/assets下的文件复制到dist/myApp/assets目录(本地已验证,CI环境需保证命令权限和依赖正常)。

3. 可选简化方案

若无需将配置文件放在assets目录,可直接将staticwebapp.config.json移到仓库根目录,此时可删除config_file_location配置(默认会在根目录查找),或设置为"/"。

验证部署

修改后重新触发GitHub Actions部署,Azure将能正确找到配置文件,并将其包含到最终部署产物中。


内容的提问来源于stack exchange,提问作者TheLegend27

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 20:23:16