You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug] macOS: npm install -g @deepseek-ai/dsh@0.1.6-alpha.1 aborts in koffi (ld: symbol(s) not found for architecture x86_64) — a stale @koromix/koffi-darwin-x64 forces a source build
#6702
If require(<koffi package dir>) succeeds, the script returns immediately and uses the prebuilt binary shipped in the platform package @koromix/koffi-darwin-x64. Here it failed, so the script logged Failed to load prebuilt binary, rebuilding from source and went to CMake — where AppleClang failed to link koffi.node (the Node symbols _napi_* / _uv_* are unresolved, i.e. -undefined dynamic_lookup was not in effect).
The reason the require failed is that npm never re-downloaded @koromix/koffi-darwin-x64: a stale copy of that directory was already sitting in node_modules. Evidence from four failed runs:
Evidence
Failed runs
The successful retry
tarball download lines for @koromix/koffi-darwin-x64
0
yes (cache miss, downloaded)
placeDep line for that package
@koromix/koffi-darwin-x64@ with an empty version
normal
info run koffi@3.3.0 install
ran -> compiled -> failed
never ran
An empty version in placeDep plus no tarball fetch is npm's "this node already exists on disk" path: npm adopts the directory from the existing tree, skips the download, and never validates its contents. So a leftover/incomplete @koromix/koffi-darwin-x64 silently turns a prebuilt-binary install into a source build.
The reverse is equally confusing: rolling back to 0.1.5-rc.2 "succeeds" simply because npm decides koffi needs no rebuild, so the install script never runs — and the broken platform package stays on disk.
Workaround that fixed it
# stop the service first (it runs from the same global package)
pm2 stop dsh-web
rm -rf /usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/@koromix \
/usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/koffi
npm cache verify
npm install -g @deepseek-ai/dsh@0.1.6-alpha.1
pm2 start dsh-web
With the stale directories gone, npm actually downloads @koromix/koffi-darwin-x64 again (1.6 MB, koffi-darwin-x64-3.3.0.tgz — verified reachable on npmmirror), checkPrebuild() succeeds, and the install script returns without invoking CMake. 0.1.6-alpha.1 then installs cleanly.
Checks that back this up
node -e "require('<...>/node_modules/koffi')" loads fine once the platform package is complete, so the prebuilt binary itself is not the problem.
SESSION_FORMAT_VERSION is 3 in both 0.1.5-rc.2 and 0.1.6-alpha.1, and the llm-pi-ai / agent-default-model settings keys still exist in 0.1.6, so nothing in ~/.dsh had to be migrated.
If it still falls back to a source build
Last resort: npm install -g @deepseek-ai/dsh@0.1.6-alpha.1 --ignore-scripts, then rebuild the packages that genuinely need it (e.g. npm rebuild -g node-pty).
Or make the compile succeed: LDFLAGS="-undefined dynamic_lookup" npm install -g ... (treats the symptom, not the cause).
Suggestion for the project
This failure is only diagnosable through a log line that npm buries inside a generic command failed. It might be worth having the launcher (or the docs) detect a loadable koffi before use, or documenting "delete node_modules/@koromix and reinstall" for this class of npm tree corruption.
Related threads (different scenarios, same module): #293 (Windows, corrupt win32-x64 prebuilt), #136 (Termux, CMake required), #5949 / #5929 / #5784 (fs-ext has no prebuilt binaries), #197 / #2459 / #6461 (Windows koffi runtime issues).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Environment
https://registry.npmmirror.com@deepseek-ai/dsh@0.1.5-rc.2installed globally and workingSymptom
npm install -g @deepseek-ai/dsh@0.1.6-alpha.1aborts while buildingkoffi@3.3.0:Switching Node versions does not help (tried v24.11.1 and v22.21.1).
Root cause
koffiis a native FFI module whose install script only compiles from source as a fallback.koffi/cnoke.cjsdecides with a one-liner:If
require(<koffi package dir>)succeeds, the script returns immediately and uses the prebuilt binary shipped in the platform package@koromix/koffi-darwin-x64. Here it failed, so the script loggedFailed to load prebuilt binary, rebuilding from sourceand went to CMake — where AppleClang failed to linkkoffi.node(the Node symbols_napi_*/_uv_*are unresolved, i.e.-undefined dynamic_lookupwas not in effect).The reason the
requirefailed is that npm never re-downloaded@koromix/koffi-darwin-x64: a stale copy of that directory was already sitting innode_modules. Evidence from four failed runs:@koromix/koffi-darwin-x64placeDepline for that package@koromix/koffi-darwin-x64@with an empty versioninfo run koffi@3.3.0 installAn empty version in
placeDepplus no tarball fetch is npm's "this node already exists on disk" path: npm adopts the directory from the existing tree, skips the download, and never validates its contents. So a leftover/incomplete@koromix/koffi-darwin-x64silently turns a prebuilt-binary install into a source build.The reverse is equally confusing: rolling back to
0.1.5-rc.2"succeeds" simply because npm decideskoffineeds no rebuild, so the install script never runs — and the broken platform package stays on disk.Workaround that fixed it
# stop the service first (it runs from the same global package) pm2 stop dsh-web rm -rf /usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/@koromix \ /usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/koffi npm cache verify npm install -g @deepseek-ai/dsh@0.1.6-alpha.1 pm2 start dsh-webWith the stale directories gone, npm actually downloads
@koromix/koffi-darwin-x64again (1.6 MB,koffi-darwin-x64-3.3.0.tgz— verified reachable on npmmirror),checkPrebuild()succeeds, and the install script returns without invoking CMake.0.1.6-alpha.1then installs cleanly.Checks that back this up
node -e "require('<...>/node_modules/koffi')"loads fine once the platform package is complete, so the prebuilt binary itself is not the problem.SESSION_FORMAT_VERSIONis3in both0.1.5-rc.2and0.1.6-alpha.1, and thellm-pi-ai/agent-default-modelsettings keys still exist in 0.1.6, so nothing in~/.dshhad to be migrated.If it still falls back to a source build
npm install -g @deepseek-ai/dsh@0.1.6-alpha.1 --ignore-scripts, then rebuild the packages that genuinely need it (e.g.npm rebuild -g node-pty).LDFLAGS="-undefined dynamic_lookup" npm install -g ...(treats the symptom, not the cause).Suggestion for the project
This failure is only diagnosable through a log line that npm buries inside a generic
command failed. It might be worth having the launcher (or the docs) detect a loadablekoffibefore use, or documenting "deletenode_modules/@koromixand reinstall" for this class of npm tree corruption.Related threads (different scenarios, same module): #293 (Windows, corrupt win32-x64 prebuilt), #136 (Termux, CMake required), #5949 / #5929 / #5784 (fs-ext has no prebuilt binaries), #197 / #2459 / #6461 (Windows koffi runtime issues).
All reactions