删除 bunx/npx 缓存,修复 deepseek harness 启动失败问题
问题现象
今天运行 deepseek harness 时直接启动失败:
bunx @deepseek-ai/dsh web
报错一长串,核心信息是插件树加载失败:
Error: dsh: plugin tree failed to load: failed to apply loader entry include (cordis:include): loader entries failed to apply
Error: failed to import loader entry session-persistence-jsonl (@deepseek-ai/dsh-session-persistence-jsonl):
The requested module '@deepseek-ai/dsh-session-persistence' does not provide an export named 'SessionAlreadyExistsError'
Error: failed to import loader entry attachment-local (@deepseek-ai/dsh-attachment-local):
The requested module '@deepseek-ai/dsh-attachment' does not provide an export named 'ImageVariantId'
...
多个插件报的都是同一类错误:从某个包里 import 的符号不存在。
原因
排查 bunx 的缓存目录(%TEMP%\bunx-*\node_modules)发现,依赖树里版本混杂了:
| 包 | 已安装版本 | 插件要求的版本 |
|---|---|---|
dsh-session-persistence |
0.1.0-rc.7 |
^0.1.5-rc.2 |
dsh-attachment |
0.1.0-rc.7 |
^0.1.5-rc.2 |
dsh-session-query |
0.1.0-rc.7 |
^0.1.5-rc.2 |
| 其余插件包 | 0.1.5-rc.2 |
— |
也就是说:bunx 之前安装的缓存目录没有随包版本完整更新,导致少数“接口包”停留在旧版本,而新版本插件却按新版接口去 import 新导出的符号(如 SessionAlreadyExistsError、ImageVariantId),于是运行时模块解析直接失败。
简单说:不是代码坏了,是缓存里的依赖树版本不一致。
修复步骤
删除 bunx 缓存,强制重新解析安装即可。
bunx:
Remove-Item -Recurse -Force "$env:TEMP\bunx-*"
bun pm cache rm # 可选,清 bun 全局包缓存
npx(同理,缓存在 npm cache 的 _npx 子目录):
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\npm-cache\_npx"
# 改过 npm cache 位置的话:
Remove-Item -Recurse -Force "$(npm config get cache)\_npx"
然后重新运行:
bunx @deepseek-ai/dsh web
首次会重新下载依赖,之后正常输出:
dsh web: http://127.0.0.1:3080/?token=...
小结
- 用
bunx/npx跑的工具,缓存目录可能长期不清理,遇到“依赖版本混杂、找不到导出符号”之类的报错,优先怀疑缓存。 - 修复方式就是删缓存重装,成本低、见效快。
- 记住两个缓存位置:bunx 在系统临时目录
%TEMP%\bunx-*,npx 在%LOCALAPPDATA%\npm-cache\_npx。

浙公网安备 33010602011771号