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

Angular 17集成Electron报错:styles.css未找到及路由问题求助

Angular 17 + Electron 升级后找不到styles.css及路由异常问题

我有一个基于Angular 15的Electron应用,原本运行状态良好。将其升级至Angular 17及最新版Electron后,执行npm run electron时出现异常错误,不清楚为何找不到styles.css,也不确定首页路由代码存在什么问题。

Error NG04002

有PR展示了Angular 15与17版本的差异,核心变化是构建目录从dist/ng-demo变为dist/ng-demo/browser。我已经修改了main.js文件及package.json中的build.files配置,但问题仍未解决。

复现步骤

Angular 15版本(运行正常)

  • 执行以下命令:
git clone -b electron https://github.com/mraible/ng-demo
npm ci && npm run electron

Angular 17版本(出现截图中的错误)

  • 执行以下命令:
git clone -b electron-v17 https://github.com/mraible/ng-demo
cd ng-demo
npm i
npm run electron

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 21:27:14