Replies: 2 comments 5 replies
|
问题找到了,不在你装 DSH 的 F:\Software\DSHarness... 目录里,而是用户目录下 profile 配置文件开头多了个「幽灵字符」。 你的 package.json 开头带了一个 UTF-8 BOM(就是 EF BB BF 这三个字节)。JSON 解析器只认纯文本开头,看到这个看不见的 U+FEFF 直接撂挑子——报错里那个 就是它。Windows 下用记事本或某些工具保存文件,很容易偷偷给你加上。 出错文件:readProfileManifest(profile.ts:264)读的是 $DSH_HOME/profiles//package.json,$DSH_HOME 默认 ~/.dsh。你跑 dsh web,就是: 复制 powershell 修(二选一): VSCode 打开文件,右下角编码切成 UTF-8(不带 BOM),保存。 对了,profile 目录下其他手写的 JSON 也顺手检查下,Windows 下这个坑挺常见的。 给维护者的建议:readProfileManifest 解析前 strip 一下 BOM(raw.replace(/^\uFEFF/, ''))就行,一行代码的事,能救一堆 Windows 用户。 最后推荐两个社区工具,以后启动类问题可以先跑诊断: astra3294/dsh-doctor:CLI 一键诊断/恢复,web 挂掉也能用 |
|
从堆栈看,失败发生在 profile manifest 的 堆栈通常会打印准确路径;profile 文件一般位于 PowerShell 可先检查文件头: $root = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' }
$manifest = Join-Path $root 'profiles\web\package.json'
$bytes = [System.IO.File]::ReadAllBytes($manifest)
$bytes[0..([Math]::Min(7, $bytes.Length - 1))] | ForEach-Object { $_.ToString('X2') }如果前三个字节是 Copy-Item $manifest "$manifest.bak" -Force
$text = [System.IO.File]::ReadAllText($manifest).TrimStart([char]0xFEFF)
[System.IO.File]::WriteAllText($manifest, $text, [System.Text.UTF8Encoding]::new($false))
Get-Content -Raw $manifest | ConvertFrom-Json | Out-Null
dsh --profile web --dump-config不要先删除整个 profile,其中可能包含插件依赖和有序 bundle 列表。如果 BOM 之后又出现,需要检查哪个编辑器、脚本或同步工具重写了 manifest。 我把原因、定位方式、安全恢复和验证步骤补进了英文 Windows 指南: |
Uh oh!
There was an error while loading. Please reload this page.
PS F:\Software\DSHarness\deepseek-harness-desktop-master> pnpm dsh web
$ node --import tsx/esm apps/cli/src/bin.ts "web"
<anonymous_script>:1
{
^
SyntaxError: Unexpected token '', "{
"n"... is not valid JSON
at JSON.parse ()
at readProfileManifest (F:\Software\DSHarness\deepseek-harness-desktop-master\packages\boot\app-boot\src\profile.ts:272:23)
at loadProfile (F:\Software\DSHarness\deepseek-harness-desktop-master\packages\boot\app-boot\src\profile.ts:385:55)
at prepareProfile (F:\Software\DSHarness\deepseek-harness-desktop-master\apps\cli\src\profile-boot.ts:100:19)
at composeProfile (F:\Software\DSHarness\deepseek-harness-desktop-master\apps\cli\src\profile-boot.ts:146:19)
at runProfile (F:\Software\DSHarness\deepseek-harness-desktop-master\apps\cli\src\profile-boot.ts:208:20)
at (F:\Software\DSHarness\deepseek-harness-desktop-master\apps\cli\src\bin.ts:32:11)
Node.js v24.19.0
All reactions