Skip to content

macOS 上余额查询报 spawn ... ENOENT,路径处理为 Windows 专用导致插件不可用 #1

Closed

Description

@liu3734

环境

  • 系统:macOS(POSIX)
  • DSH:@deepseek-ai/dsh 0.1.0-rc.6(npx @deepseek-ai/dsh web 启动,profile: web)
  • 插件:@feiyang666/deepseekharnessdesktop 1.3.2(dsh plugin --profile web add 安装,接线正常)

复现步骤

  1. 按 README 方法 A 安装插件并重启服务,顶部 tab 正常出现;
  2. 在「设置 → 模型」配置好 DEEPSEEK_API_KEY(单独用 curl 调 https://api.deepseek.com/user/balance 返回 200,Key 与网络均正常);
  3. 打开「剩余余额查询」tab,点击「查询余额」。

实际表现

查询失败:

执行失败:spawn /Users/abcd/.local/bin/node ENOENT

同一时刻,插件还在主目录下创建了一个文件名带字面反斜杠的怪文件:
/Users/abcd/\Users\abcd\dsh-usage\usage-records.json(内容 [])。

原因分析

lib/index.js 的路径处理是 Windows 专用的:

  1. const normPath = (p) => String(p).replace(///g, '\') —— 把 /Users/abcd/ 转成 \Users\abcd\,在 POSIX 上变成(相对 fs cwd 解析的)伪路径;
  2. 所有路径拼接硬编码反斜杠,如 root + '\dsh-usage\usage-records.json'、dirs() 里的四个目录、导出路径等;
  3. 三处 subprocess.spawn 的 cwd: root || 'C:\'(第 452 / 566 / 601 行附近)——macOS 上 root 是上述伪路径(不存在),C:\ 也不存在,Node spawn 直接 ENOENT。这正是余额查询(以及 PNG 导出等所有走 spawnNode 的功能)失败的根因;
  4. revealDir 写死 explorer.exe、pickDirectory 写死 PowerShell,macOS 上「打开目录」「选择目录」同样不可用。

建议修复

  • normPath / 路径拼接按平台使用 node:path(sep、join),POSIX 上不做 / → \ 转换;
  • spawn 的 cwd 做存在性校验,无效时回退 process.cwd();
  • revealDir 在 darwin 改用 open、linux 改用 xdg-open;
  • pickDirectory 在 darwin 可用 osascript -e 'POSIX path of (choose folder)' 实现原生目录选择。

附注

我在本机按上述方案直接补丁了已安装的 lib/index.js(约 20 行,Windows 分支行为不变),重启后余额查询、用量落盘、导出打开目录均恢复正常,可作为参考。希望官方发布兼容 POSIX 的版本或接受 PR。

Activity

  1. feiyang-dev commented on Aug 15, 2026

    @feiyang-dev
    Owner

    官方已经收到问题了,马上进行处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions