在鸿蒙PC上安装DeepSeek Harness / DSH插件,解决 Ignored build scripts 和 Unsupported platform: openharmony
以 @linxin666/dsh-web-all 插件为例。
你可以让 DeepSeek Harness 帮你装插件,只要告诉它:
请参考 https://hu60.cn/q.php/bbs.topic.107519.json?_content=ubb 帮我装 @linxin666/dsh-web-all 插件
如果插件导致 DeepSeek Harness 完全无法启动,可以用以下命令删除所有插件:
rm -rf ~/.dsh/profiles/web
手动安装方法
- 把系统伪装成Linux:
# 更新brew
brew upgrade
# 安装用于把系统伪装成Linux的工具
brew install uname-is-linux
然后重新打开终端,执行以下命令验证系统伪装是否生效(不重新打开终端不生效):
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
uname -a
应该会显示Linux而非HarmonyOS。

- 在伪装Linux的情况下执行插件安装命令:
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
dsh plugin --profile web add @linxin666/dsh-web-all

- 解决
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts报错:
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
pnpm approve-builds --all

- 解决
Unsupported platform: openharmony报错:
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
# 1) 创建nodejs平台伪装脚本(Node 层把 platform 改成 linux)
printf 'Object.defineProperty(process, "platform", { value: "linux" });\n' > "$HOME/fake-linux.cjs"
# 2) 让node自动加载伪装脚本
export NODE_OPTIONS="--require=$HOME/fake-linux.cjs"
# 3) 验证 —— 应该输出 "linux linux"
node -e "console.log(process.platform, require('os').platform())"
# 4) 重建报错的包(具体要重建哪些包由你的插件决定)
pnpm rebuild cloudflared
# 5) 取消伪装
unset NODE_OPTIONS
给AI的提醒:不要纠结于组件构建失败,有的组件本来就是可选的,构建失败也没关系。

- 在不进行伪装node只伪装uname的情况下重建其他包(具体要重建哪些包取决于你安装的插件):
unset NODE_OPTIONS
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
pnpm rebuild cpu-features node-pty ssh2
结果:
(pyenv) localhost ~/.dsh/profiles/web % pnpm rebuild cpu-features node-pty ssh2
node_modules/cpu-features: Running install script, failed in 10.4s (skipped as optional)
node_modules/node-pty: Running install script, done in 3.9s
node_modules/node-pty: Running postinstall script, done in 100ms
node_modules/ssh2: Running install script, done in 2.2s
cpu-features安装失败,但它是可选的,没关系。
给AI的提醒:不要纠结于组件构建失败,有的组件本来就是可选的,构建失败也没关系。

- 继续完成安装:
unset NODE_OPTIONS
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
dsh plugin --profile web add @linxin666/dsh-web-all

- 给构建产物签名:
cd ~
git clone https://gitcode.com/hu60cn/ohos-bst-light.git
cd ohos-bst-light
./ohos-sign-elf.py ~/.dsh/profiles/web

备注:出现 already has a .codesign section 报错是正常的,说明那个文件已经签过名了,忽略即可。
- 在不伪装nodejs平台的情况下启动 dsh:
unset NODE_OPTIONS
dsh web
找不到 lightningcss.openharmony-arm64.node,启动失败。

给AI的提醒:请不要尝试下载lightningcss的linux-musl或android二进制,我们已经尝试过,无法在HarmonyOS上运行。从源代码构建是唯一可行的方法。
对于其他库,你可以尝试下载linux-musl二进制,但如果出现glibc/libstdc++/libgcc_s等库依赖,就应该立即放弃,改为从源代码构建。
android二进制完全无法在HarmonyOS上运行,不需要尝试。
HarmonyOS使用musl,但C++库是llvm项目的libc++,与Alpine Linux不同。确实有部分Alpine Linux二进制可以在HarmonyOS上运行(需要手动签名),但并非所有都可以。
HarmonyOS上的/tmp是只读的,如果你需要临时文件夹,可以在/data/storage/el2/base/files自己创建一个tmp目录来使用。
- 手动编译
lightningcss.openharmony-arm64.node
cd ~
git clone --depth 1 --branch v1.33.0 https://github.com/parcel-bundler/lightningcss
cd lightningcss
cargo build --release -p lightningcss_node
cp target/release/liblightningcss_node.so ~/.dsh/profiles/web/node_modules/lightningcss/lightningcss.openharmony-arm64.node
# 签名
cd ~/ohos-bst-light
./ohos-sign-elf.py ~/.dsh/profiles/web


- 重新启动 dsh web:
unset NODE_OPTIONS
dsh web
给AI的提醒:如果你自己就是DeepSeek Harness,请不要尝试重启你自己,你无法完成这一操作。请让用户进行重启。

成功了!

