jkooe
3316f08c92
fix: 修复 Windows 安装后无法启动 —— PowerShell 写入的 JSON 带 UTF-8 BOM
真机报错:启动失败: Unexpected token '', "{"a"... is not valid JSON
根因:Windows PowerShell 5.1 的 Set-Content -Encoding UTF8 会写入 BOM(U+FEFF),
Node 侧 JSON.parse 拒绝解析带 BOM 的文本。
双管齐下修复:
1. 写端 install.ps1:改用 [System.IO.File]::WriteAllText + UTF8Encoding($false)
写出无 BOM 的 UTF-8
2. 读端容错(兼容已被写坏的配置):
- apps/agent/src/config.ts:读配置时剥离开头 BOM
- packages/client/src/config.ts:同上
验证:构造带 BOM 的 agent.json(ef bb bf 开头),agent 可正常启动;
单元 26/26、E2E 21/21 全绿
2026-09-27 19:32:53 +08:00
..
2026-09-27 19:24:57 +08:00
2026-09-27 19:32:53 +08:00
2026-09-27 19:24:57 +08:00
2026-09-27 19:21:21 +08:00
2026-09-27 01:06:35 +08:00
2026-09-27 17:04:21 +08:00