Replies: 6 comments 1 reply
|
Reproduced and root-caused (Windows, Node 24). The crash is a UTF-8 BOM reaching Repro const raw = Buffer.from([0xEF, 0xBB, 0xBF]).toString() + '{"dependencies":{}}'
JSON.parse(raw) // SyntaxError: Unexpected token '?', "?{"dependencies":{}}" is not valid JSON
JSON.parse(raw.replace(/^\uFEFF/, '')) // worksRoot cause raw = readFileSync(path, 'utf8') // line 267: BOM is preserved by readFileSync
const parsed = JSON.parse(raw) ... // line 272: JSON.parse rejects U+FEFFA BOM written by PowerShell ( Minimal fix (one line) - raw = readFileSync(path, 'utf8')
+ raw = readFileSync(path, 'utf8').replace(/^\uFEFF/, '')The same class exists at the other Happy to prepare a cherry-pick-ready patch (with a fixture test) for when the PR channel opens. This is also a good candidate for a |
|
Shipped the promised preflight: dsh-plugin-doctor v1.6.0 now includes a npx dsh-plugin-doctor --profile ~/.dsh/profiles/web --jsonVerified end-to-end on Windows:
Release: https://github.com/zoahdev/dsh-plugin-doctor/releases/tag/v1.6.0 ? tests 15/15 (new fixture covers BOM/clean/missing). The upstream one-line fix ( |
|
Cherry-pick-ready patch is now staged on the fork, built directly on upstream
When the PR channel opens, either commit can be cherry-picked as-is. |
|
UTF-8 BOM 让 JSON 解析崩(Windows 记事本保存常带 BOM)——建议:package.json 用无 BOM 的 UTF-8 保存(VS Code 默认就是无 BOM,记事本另存为选 UTF-8 不带 BOM)。 Windows 配置文件编码坑(含 BOM/换行)第 3 章有整理:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/03-profiles.md |
|
补充:这个问题会“反复出现”,因为 profile 的 实际遇到的情况:
对用户的建议:
这也说明官方侧在 |
|
顺便宣传一下我们的项目https://github.com/ysr666/dsh-vision-router |
Uh oh!
There was an error while loading. Please reload this page.
问题现象
在 Windows 上通过源码仓库运行
pnpm dsh web(或npx @deepseek-ai/dsh web)时,启动立即失败:复现步骤
pnpm install/pnpm build,或 npx 安装);~/.dsh/profiles/<profile>/package.json(例如安装插件后手工调整依赖),并用带 BOM 的 UTF-8 保存(部分 Windows 编辑器默认会写入 BOM);dsh web,立刻报is not valid JSON。根因
packages/boot/app-boot/src/profile.ts的readProfileManifest直接对文件内容调用JSON.parse,没有先去除文件开头的 UTF-8 BOM(\uFEFF)。JSON 规范不允许在{前出现该字符,因此只要 manifest 文件带 BOM 就必然解析失败。这不是插件或用户配置内容的问题:文件内容本身是合法 JSON,多出来的只是开头 3 个字节(
EF BB BF)。临时解决方法
把
~/.dsh/profiles/<profile>/package.json重新保存为 UTF-8(无 BOM):UTF-8;建议修复
在
readProfileManifest读取文件后、JSON.parse前去掉 BOM:或更简单:
All reactions