openclaw - ✅(Solved) Fix openclaw update can leave the global openclaw bin missing after npm global update [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63719Fetched 2026-04-10 03:42:05
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

Running openclaw update on a global npm install successfully upgraded OpenClaw from 2026.4.8 to 2026.4.9, but the public CLI entrypoint disappeared immediately afterwards.

The package itself was installed correctly under the global node_modules path, and invoking the package entry directly still worked. The breakage was specifically the global bin link: ~/.npm-global/bin/openclaw was gone, while npm left a hidden temporary link like .openclaw-OKPnnPWD behind.

Error Message

  1. If repair is unsafe, fail the update with a clear error instead of leaving openclaw unusable.

Root Cause

Running openclaw update on a global npm install successfully upgraded OpenClaw from 2026.4.8 to 2026.4.9, but the public CLI entrypoint disappeared immediately afterwards.

The package itself was installed correctly under the global node_modules path, and invoking the package entry directly still worked. The breakage was specifically the global bin link: ~/.npm-global/bin/openclaw was gone, while npm left a hidden temporary link like .openclaw-OKPnnPWD behind.

Fix Action

Workaround

ln -sfn ../lib/node_modules/openclaw/openclaw.mjs ~/.npm-global/bin/openclaw
rm -f ~/.npm-global/bin/.openclaw-*

PR fix notes

PR #63794: fix: repair missing bin symlink after npm global update

Description (problem / solution / changelog)

Summary

After openclaw update, npm's reify process renames the bin symlink (e.g. bin/openclaw) to a temp name (.openclaw-OKPnnPWD) and may fail to restore it, leaving the openclaw command unavailable.

  • Adds repairGlobalBinLinks which runs after a global npm install to clean stale temp bin entries and recreate missing bin symlinks from the package's bin manifest
  • Adds readPackageBin helper to read bin entries from package.json
  • Adds two unit tests covering the repair and no-op cases

Closes #63719


This PR was developed with AI assistance (Claude). Built with islo.dev

Changed files

  • src/agents/pi-embedded-runner/run.overflow-compaction.harness.ts (modified, +2/-0)
  • src/infra/package-json.ts (modified, +23/-0)
  • src/infra/update-global.test.ts (modified, +87/-0)
  • src/infra/update-global.ts (modified, +103/-0)
  • src/infra/update-runner.ts (modified, +21/-9)

Code Example

openclaw update

---

node /home/bruce/.npm-global/lib/node_modules/openclaw/openclaw.mjs --version

---

OpenClaw 2026.4.9 (0512059)

---

3827 silly reify mark retired [
3827 silly reify   '/home/bruce/.npm-global/lib/node_modules/openclaw',
3827 silly reify   '/home/bruce/.npm-global/bin/openclaw'
3827 silly reify ]
3828 silly reify moves {
3828 silly reify   '/home/bruce/.npm-global/lib/node_modules/openclaw': '/home/bruce/.npm-global/lib/node_modules/.openclaw-C0Srzpq8',
3828 silly reify   '/home/bruce/.npm-global/bin/openclaw': '/home/bruce/.npm-global/bin/.openclaw-OKPnnPWD'
3828 silly reify }

---

ln -sfn ../lib/node_modules/openclaw/openclaw.mjs ~/.npm-global/bin/openclaw
rm -f ~/.npm-global/bin/.openclaw-*
RAW_BUFFERClick to expand / collapse

Summary

Running openclaw update on a global npm install successfully upgraded OpenClaw from 2026.4.8 to 2026.4.9, but the public CLI entrypoint disappeared immediately afterwards.

The package itself was installed correctly under the global node_modules path, and invoking the package entry directly still worked. The breakage was specifically the global bin link: ~/.npm-global/bin/openclaw was gone, while npm left a hidden temporary link like .openclaw-OKPnnPWD behind.

Environment

  • Install type: global npm install
  • Global prefix: /home/bruce/.npm-global
  • OS: Linux 6.8.0-107-generic
  • Node: 22.22.2
  • OpenClaw before update: 2026.4.8 (9ece252)
  • OpenClaw after update: 2026.4.9 (0512059)

What happened

  1. Ran:
    openclaw update
  2. The update completed successfully.
  3. Afterwards, openclaw returned command not found.
  4. The package entry still existed and worked:
    node /home/bruce/.npm-global/lib/node_modules/openclaw/openclaw.mjs --version
    Output:
    OpenClaw 2026.4.9 (0512059)
  5. The public bin link was missing from ~/.npm-global/bin/.

npm debug log evidence

From:

  • ~/.npm/_logs/2026-04-09T09_28_59_782Z-debug-0.log

Relevant lines:

3827 silly reify mark retired [
3827 silly reify   '/home/bruce/.npm-global/lib/node_modules/openclaw',
3827 silly reify   '/home/bruce/.npm-global/bin/openclaw'
3827 silly reify ]
3828 silly reify moves {
3828 silly reify   '/home/bruce/.npm-global/lib/node_modules/openclaw': '/home/bruce/.npm-global/lib/node_modules/.openclaw-C0Srzpq8',
3828 silly reify   '/home/bruce/.npm-global/bin/openclaw': '/home/bruce/.npm-global/bin/.openclaw-OKPnnPWD'
3828 silly reify }

Why this seems updater-related

From the updater code path for global installs, it looks like OpenClaw:

  • detects the package manager
  • runs a global install (npm i -g <spec> / pnpm add -g <spec>)
  • cleans package-level rename dirs via cleanupGlobalRenameDirs(...)

I did not find a corresponding cleanup or verification path for hidden bin-level rename leftovers such as:

  • ~/.npm-global/bin/.openclaw-*

So this appears to be a case where npm reify retired the public bin to a temp name, but the final public bin link was not restored, and the updater did not catch or repair that state.

Expected behavior

After openclaw update succeeds on a global npm install:

  • openclaw --version should work immediately
  • ~/.npm-global/bin/openclaw should exist and resolve to the installed package entry
  • temporary .openclaw-* bin leftovers should be cleaned up automatically

Actual behavior

  • the package updated successfully
  • the gateway came back fine
  • but the openclaw command disappeared until manual symlink repair

Workaround

ln -sfn ../lib/node_modules/openclaw/openclaw.mjs ~/.npm-global/bin/openclaw
rm -f ~/.npm-global/bin/.openclaw-*

Suggested fix directions

  1. After global update, explicitly verify that the public bin path resolves correctly.
  2. If the package entry exists but the public bin is missing, recreate it automatically.
  3. Clean up stale bin-level temp links matching .openclaw-* in the global bin dir.
  4. If repair is unsafe, fail the update with a clear error instead of leaving openclaw unusable.

extent analysis

TL;DR

The most likely fix is to modify the OpenClaw updater to verify and recreate the public bin link after a global update, and clean up any temporary bin links.

Guidance

  • Verify that the public bin path resolves correctly after a global update by checking if the ~/.npm-global/bin/openclaw link exists and points to the correct package entry.
  • Recreate the public bin link automatically if it is missing, using a command like ln -sfn ../lib/node_modules/openclaw/openclaw.mjs ~/.npm-global/bin/openclaw.
  • Clean up any temporary bin links matching .openclaw-* in the global bin dir to prevent clutter and potential issues.
  • Consider failing the update with a clear error if the public bin link cannot be recreated, to prevent leaving the openclaw command unusable.

Example

A possible implementation of the fix could involve adding a post-update step to the OpenClaw updater, like this:

# Verify and recreate public bin link
if [ ! -e ~/.npm-global/bin/openclaw ]; then
  ln -sfn ../lib/node_modules/openclaw/openclaw.mjs ~/.npm-global/bin/openclaw
fi

# Clean up temporary bin links
rm -f ~/.npm-global/bin/.openclaw-*

Notes

This fix assumes that the issue is specific to the OpenClaw updater and its interaction with npm's global install mechanism. The suggested fix directions provided in the issue body seem like a good starting point for addressing the problem.

Recommendation

Apply the workaround provided in the issue body, which involves manually recreating the public bin link and cleaning up temporary bin links, until a permanent fix can be implemented in the OpenClaw updater. This will restore the openclaw command to a working state.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

After openclaw update succeeds on a global npm install:

  • openclaw --version should work immediately
  • ~/.npm-global/bin/openclaw should exist and resolve to the installed package entry
  • temporary .openclaw-* bin leftovers should be cleaned up automatically

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING