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

从Angular 16升级到17后运行应用出现crbug/1173575错误求助

解决Angular 17 ng serve 触发crbug/1173575错误的启动方案

1. 切换到Angular 17默认Vite开发服务器

Angular 17已默认采用Vite作为开发服务器,若你的项目仍沿用旧Webpack配置,可显式指定Vite启动:

ng serve appName --serve-target=development-vite

也可修改angular.json中对应项目的serve配置,替换构建器为Vite版本:

"serve": {
  "builder": "@angular-devkit/build-angular:dev-server-vite",
  "configurations": {
    "production": {
      "buildTarget": "appName:production"
    },
    "development": {
      "buildTarget": "appName:development"
    }
  },
  "defaultConfiguration": "development"
}

修改后直接执行ng serve appName即可启用Vite服务器,多数情况下可解决该Chrome兼容性错误。

2. 临时禁用源映射

若Vite方案无效,可尝试关闭开发环境的源映射,减少非JS模块加载问题:
修改angular.json中项目build配置的sourceMap为false:

"build": {
  "builder": "@angular-devkit/build-angular:application",
  "options": {
    "sourceMap": false,
    // 其他原有配置...
  }
}

保存后重新启动服务:

ng serve appName

3. 更新Chrome浏览器至最新稳定版

该错误属于Chrome已知的ES模块处理bug,更新到最新稳定版Chrome,部分旧版本的兼容性问题会自动修复。

4. 清理缓存后重新构建

执行以下命令清理项目缓存与依赖,重新构建项目:

npm cache clean --force
rm -rf node_modules package-lock.json
npm install
ng build appName --configuration=development
ng serve appName

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 11:35:01