openclaw - ✅(Solved) Fix [Bug]: openclaw update should respect OPENCLAW_HOME [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#78371Fetched 2026-05-07 03:37:36
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
3
Author
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

openclaw update ignores OPENCLAW_HOME environment variable and installs to npm global prefix instead of the custom installation directory.

Root Cause

openclaw update ignores OPENCLAW_HOME environment variable and installs to npm global prefix instead of the custom installation directory.

Fix Action

Fixed

PR fix notes

PR #78393: fix(update): preserve pnpm custom global root

Description (problem / solution / changelog)

Summary

  • Detect pnpm-managed OpenClaw installs from the running package root even when pnpm root -g points at a different default global root.
  • Preserve the owning pnpm --global-dir during package updates so openclaw update updates the active custom install instead of creating a second install under the default pnpm root.
  • Keep the pnpm inference narrow by requiring pnpm's node_modules/.modules.yaml metadata in addition to the global layout/lockfile markers, and cover pnpm's actual global virtual-store layout (<global-dir>/5/.pnpm/.../node_modules/openclaw).
  • Add a changelog entry for #78377.

Fixes #78377.

Verification

  • pnpm test src/infra/update-global.test.ts src/infra/package-update-steps.test.ts src/cli/update-cli.test.ts
  • pnpm exec oxfmt --check --threads=1 src/infra/update-global.ts src/infra/update-global.test.ts src/infra/package-update-steps.ts src/infra/package-update-steps.test.ts src/cli/update-cli/update-command.ts CHANGELOG.md
  • git diff --check
  • Rebased cleanly on latest origin/main; post-rebase git diff --check and diff/stat sanity passed.
  • Installed a packed OpenClaw tarball through the real pnpm CLI with PNPM_HOME=<tmp>/pnpm-home pnpm --allow-build=@openclaw/fs-safe add -g --global-dir <tmp>/custom-global <pack.tgz>, then ran the installed <tmp>/pnpm-home/openclaw update --yes --no-restart --json --tag latest. The update returned status: ok, mode: pnpm, and the global update step was pnpm add -g --global-dir <tmp>/custom-global <pack.tgz> while the default pnpm root remained <tmp>/pnpm-home/global/5/node_modules.
  • Hetzner Crabbox installed-CLI validation initially reproduced the incomplete behavior (mode: npm from the pnpm virtual-store package root). After the virtual-store fix, Hetzner reruns were blocked before execution by Crabbox remote sync sanity (17779 tracked deletions), so the final installed-CLI proof above was run locally against the same openclaw CLI/update path.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/cli/update-cli/update-command.ts (modified, +6/-1)
  • src/infra/package-update-steps.test.ts (modified, +3/-2)
  • src/infra/package-update-steps.ts (modified, +7/-6)
  • src/infra/update-global.test.ts (modified, +154/-0)
  • src/infra/update-global.ts (modified, +81/-3)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

openclaw update ignores OPENCLAW_HOME environment variable and installs to npm global prefix instead of the custom installation directory.

Steps to reproduce

  1. Install OpenClaw to a custom directory (e.g., D:\openclaw)
  2. Set OPENCLAW_HOME environment variable to that directory (system-level)
  3. Run openclaw update
  4. Observe that the new version is installed to npm global prefix (C:\Users...\AppData\Roaming\npm) instead of the OPENCLAW_HOME directory

Expected behavior

openclaw update should detect OPENCLAW_HOME environment variable or the current running location and update OpenClaw there, instead of using npm global prefix.

Actual behavior

After running openclaw update, the new version is installed to C:\Users...\AppData\Roaming\npm\node_modules\openclaw instead of D:\openclaw\node_modules\openclaw where the current instance is running from.

OpenClaw version

2026.4.14 → 2026.5.4

Operating system

Windows 10

Install method

pnpm global install to custom directory (D:\openclaw)

Model

N/A - this is a CLI tool issue, not related to model

Provider / routing chain

N/A - this is a CLI tool issue, not related to provider routing

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Users with custom installation directories (e.g., D:\openclaw) Severity: Medium (causes confusion and dual installations) Frequency: Always Consequence: Updates install to wrong location, user has two installations

Additional information

No response

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

openclaw update should detect OPENCLAW_HOME environment variable or the current running location and update OpenClaw there, instead of using npm global prefix.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: openclaw update should respect OPENCLAW_HOME [1 pull requests, 1 comments, 2 participants]