openclaw - ✅(Solved) Fix [Bug]: update status mis-detects npm global installs as pnpm [1 pull requests, 2 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#51401Fetched 2026-04-08 01:11:38
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
commented ×2cross-referenced ×2referenced ×1

openclaw update status mis-detects the install method as pnpm on macOS when OpenClaw was actually installed via npm install -g openclaw.

Root Cause

This leaks into operational guidance:

  • openclaw update status shows Install: pnpm
  • health / audit / operator workflows may recommend the wrong upgrade command
  • users can be told to use pnpm even though their real install path is npm global

Fix Action

Fixed

PR fix notes

PR #51563: fix(status): detect actual global install PM instead of repo packageManager field

Description (problem / solution / changelog)

Fixes #51401

openclaw update status incorrectly reports Install: pnpm for npm global installs because detectPackageManager() reads package.json.packageManager — which reflects the repo's build tool, not the user's install method.

Changes

  • src/infra/detect-package-manager.ts: Add detectGlobalInstallManager(resolvedRoot) that infers the actual global package manager from path heuristics:
    • /.pnpm/ or /pnpm/global/ → pnpm
    • /.bun/ → bun
    • Default → npm (no distinctive path markers)
  • src/infra/update-check.ts: For installKind === "package", use detectGlobalInstallManager(root) instead of detectPackageManager(root)
  • src/infra/detect-package-manager.test.ts: Add 6 new tests covering pnpm global, bun global, npm global (Homebrew, standard, nvm paths)

Test

pnpm test -- src/infra/detect-package-manager.test.ts src/commands/status.update.test.ts src/infra/update-check.test.ts
✓ src/infra/detect-package-manager.test.ts (9 tests) 6ms
✓ src/commands/status.update.test.ts (6 tests) 3ms
✓ src/infra/update-check.test.ts (11 tests) 17ms
Test Files  3 passed (3)
Tests       21 passed (21) → 0 failed

Changed files

  • src/infra/detect-package-manager.test.ts (modified, +37/-1)
  • src/infra/detect-package-manager.ts (modified, +29/-0)
  • src/infra/update-check.ts (modified, +10/-2)
RAW_BUFFERClick to expand / collapse

Summary

openclaw update status mis-detects the install method as pnpm on macOS when OpenClaw was actually installed via npm install -g openclaw.

Why this matters

This leaks into operational guidance:

  • openclaw update status shows Install: pnpm
  • health / audit / operator workflows may recommend the wrong upgrade command
  • users can be told to use pnpm even though their real install path is npm global

Environment

  • OpenClaw: 2026.3.13
  • OS: macOS arm64
  • Node/npm installed via Homebrew
  • Actual OpenClaw install command: npm install -g openclaw

Reproduction

  1. Install Node/npm via Homebrew
  2. Confirm npm global prefix resolves under Homebrew, for example:
    • which node -> /opt/homebrew/bin/node
    • which npm -> /opt/homebrew/bin/npm
    • npm config get prefix -> /opt/homebrew
  3. Install OpenClaw with:
    • npm install -g openclaw
  4. Run:
    • openclaw update status

Actual result

openclaw update status reports:

  • Install: pnpm

On this machine:

  • npm ls -g --depth=0 shows [email protected]
  • brew list --versions openclaw returns nothing
  • /opt/homebrew/bin/openclaw is just a symlink to the npm global package under /opt/homebrew/lib/node_modules/openclaw/openclaw.mjs

So the real install method is npm global, not pnpm.

Expected result

The reported install method should reflect the local install channel / upgrade path, for example npm, not the package manager used by the project itself.

Suspected root cause

The current detection appears to read the installed package's package.json.packageManager field and treat that as the local install method.

In the published package:

That field describes how the project/repo is maintained, not how this machine installed the package.

Relevant source pointers:

  • src/infra/detect-package-manager.ts
  • src/infra/update-check.ts
  • src/cli/update-cli/status.ts

Suggested direction

For installKind === "package", detect the actual local upgrade path separately from the repo/package metadata, e.g. by checking the resolved global package location / invocation path / package manager-specific install markers instead of trusting package.json.packageManager.

extent analysis

Fix Plan

To fix the issue, we need to modify the detect-package-manager.ts file to correctly detect the local install method. Here are the steps:

  • Check if the package is installed globally using npm by verifying the presence of the package in the global node_modules directory.
  • If the package is installed globally, use the npm command to detect the package manager.
  • Otherwise, use the existing logic to detect the package manager from the package.json file.

Example code:

// src/infra/detect-package-manager.ts
import { execSync } from 'child_process';
import { readFile } from 'fs/promises';

export function detectPackageManager(installKind: string): string {
  if (installKind === 'package') {
    // Check if package is installed globally using npm
    const npmGlobalPrefix = execSync('npm config get prefix', { encoding: 'utf-8' }).trim();
    const packagePath = `${npmGlobalPrefix}/lib/node_modules/openclaw`;
    if (require('fs').existsSync(packagePath)) {
      // Package is installed globally using npm
      return 'npm';
    }
  }
  // Existing logic to detect package manager from package.json
  const packageJson = JSON.parse(await readFile('package.json', 'utf-8'));
  return packageJson.packageManager;
}

Verification

To verify the fix, run the following commands:

  • npm install -g openclaw
  • openclaw update status

The output should show the correct install method as npm.

Extra Tips

  • Make sure to test the fix on different environments and package managers to ensure it works correctly.
  • Consider adding additional logging or debugging statements to help diagnose any future issues.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING