登录 立即注册

首页 > 绿虎论坛 > 电脑 > 鸿蒙PC (发帖)

标题: 在鸿蒙PC上安装原版DeepSeek Harness / DSH(让koffi可用,解决硬连接和权限问题)

作者: @Ta

时间: 22小时前发布,20分钟前修改

点击: 274

视频链接


更新日志:

[2026-08-15 23:55] 更新了硬连接补丁,修复了Workspace Write模式下创建文件失败的问题。请重新执行第7步应用新补丁。

[2026-08-16 00:34] 现在可以直接用 brew install deepseek-harness 安装了,不需要通过 npm 安装再自己打补丁。

旧安装的清理方法(没装过的不用清理):

rm ~/.harmonybrew/bin/dsh
rm -rf ~/.npm-global
npm config set prefix "$HOME/.harmonybrew"

然后即可直接通过brew安装DeepSeek Harness(brew的安装方法:https://harmonybrew.atomgit.com/

brew install deepseek-harness

装完即可启动(不需要打任何补丁):

dsh web

旧安装方法(不推荐)

  1. 安装 Harmonybrew:https://harmonybrew.atomgit.com/

  2. uname-is-linux 把系统伪装成Linux,避免 koffi 安装报错:

brew install -y ohos-sdk devel-base llvm-gcc-compat cmake uname-is-linux

安装完成后请重新打开终端,执行以下命令验证效果:

export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
uname -a

应该会显示Linux而非HarmonyOS

screenshot_20260815_154716.jpg(55.66 KB)

  1. 安装 DeepSeek Harness 到单独的 "$HOME/.npm-global" 目录:
brew install python3 node

npm config set prefix "$HOME/.npm-global"

export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
npm install -g @deepseek-ai/dsh --verbose

如果还是在安装koffi的时候报错,请重新打开终端让uname伪装生效。

image.png(0.99 MB)
image.png(1.06 MB)

  1. ohos-sdk附带的binary-sign-tool命令对koffi库进行签名,让koffi能正常加载(不签名会报Permission denied错误):
f="$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/koffi/build/koffi/openharmony_arm64/koffi.node"; binary-sign-tool sign -inFile "$f" -outFile "$f" -selfSign 1

完整的签名工具教程(包括另一个可以给claude二进制签名的第三方签名工具):
https://hu60.cn/q.php/bbs.topic.107186.html#nav

  1. 解决缺少sharp库的问题:
cd "$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh"
npm install --no-save --no-package-lock --no-audit --no-fund @img/sharp-wasm32@0.35.3
  1. 解决node启动时缺少--expose-internals参数的问题:
sed -i 's@^#!/usr/bin/env node$@#!'"$HOME"'/.harmonybrew/bin/node --expose-internals@' "$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/lib/bin.js"

这条命令是把 $HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/lib/bin.js 的第一行改成 #!/storage/Users/currentUser/.harmonybrew/bin/node --expose-internals

  1. 修复硬连接创建失败导致的500错误:

本轮运行失败EACCES: permission denied, link '/storage/Users/currentUser/.dsh/sessions/--storage-Users-currentUser-work-wine-WineHua--/session-207ab6ad-2f89-445f-8e60-c11b72a2de56/session.jsonl.zstd.55acf2760149.tmp' -> '/storage/Users/currentUser/.dsh/sessions/--storage-Users-currentUser-work-wine-WineHua--/session-207ab6ad-2f89-445f-8e60-c11b72a2de56/session.jsonl.zstd'

image.png(62.05 KB)

执行以下脚本应用硬连接补丁,脚本会把 DeepSeek Harness 的硬连接操作改为直接复制文件(两个文件是一样的,下载哪个都可以):

下载脚本后在文件管理器里找到脚本文件,右击空白处,选“更多”,选“在终端中打开”,然后运行以下命令即可:

sh ./ohos-patch-dsh-hardlink.sh

备注:如果补丁有问题,可以用以下方式撤销补丁,还原到未打补丁的状态:

# 补丁没问题的时候不用执行
sh ./ohos-patch-dsh-hardlink.sh --restore
  1. 解决HMDFS权限问题导致第二次启动时报错:

Error: dsh: plugin tree failed to load: failed to apply loader entry include (cordis:include): failed to apply loader entry credentials (@deepseek-ai/dsh-credentials-local): credentials-local: /storage/Users/currentUser/.dsh/.credentials.yaml is readable beyond its owner (mode 660); run "chmod 600 /storage/Users/currentUser/.dsh/.credentials.yaml" before starting again
Error: credentials-local: /storage/Users/currentUser/.dsh/.credentials.yaml is readable beyond its owner (mode 660); run "chmod 600 /storage/Users/currentUser/.dsh/.credentials.yaml" before starting again

rm -rf ~/.dsh
mkdir /data/storage/el2/base/files/dsh
ln -s /data/storage/el2/base/files/dsh ~/.dsh

/data/storage/el2/base/files是正常的f2fs文件系统,权限可以正常设为660,不过还是不支持硬连接。

  1. 把 dsh 命令链接到 harmonybrew 的 bin 目录,方便后续调用:
ln -s ~/.npm-global/bin/dsh ~/.harmonybrew/bin
  1. 启动 dsh web 服务:
dsh web

image.png(35.4 KB)

然后就可以访问 http://127.0.0.1:3080 进行使用了。

常见问题

  1. DeepSeek Harness 无法执行任何命令

安装 bash 即可:

brew install bash

image.png(47.76 KB)
image.png(530.15 KB)

  1. 海泰浏览器访问 DeepSeek Harness 接口始终返回403错误

海泰浏览器(左)的Origin头不含端口,会导致API返回403错误。换成海泰极速浏览器(右)就没有这个问题了。

image.png(763.97 KB)

在海泰浏览器里选择“重置设置”也可以解决该问题。

image.png(86.47 KB)


[隐藏样式|查看源码]


『回复列表(1|隐藏机器人聊天)』

1.

使用截图:

image.png(811.4 KB)
image.png(768.61 KB)
image.png(873.7 KB)

(/@Ta/2026-08-15 22:02//)

回复需要登录

8月16日 11:28 星期天

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1