Skip to content

fix(postinstall): catch EACCES when pruning shared OpenClaw compile cache #76353

Description

@RayWoo

Bug

scripts/postinstall-bundled-plugins.mjs lines 787-791 attempt to prune /tmp/node-compile-cache/v<NODE>-x64-<HASH>-0. When the directory is owned by a different user (e.g., created by a previous root-owned install or by a shared cache from another user on the same host), the prune fails:

[postinstall] could not prune OpenClaw compile cache: Error: EACCES, Permission denied: /tmp/node-compile-cache/v24.13.0-x64-cf738c9d-0

The script handles this with a try/catch that emits a warning, but the warning misleads users into thinking something is broken.

Impact

Cosmetic. Postinstall completes successfully; the WARN just adds noise during the upgrade workflow. Particularly visible when the v5.2 upgrade procedure prescribes running node scripts/postinstall-bundled-plugins.mjs manually with OPENCLAW_EAGER_BUNDLED_PLUGIN_DEPS=1 after --ignore-scripts install.

Proposed fix

In the catch block, check err.code === "EACCES" and silently skip:

} catch (err) {
  if (err.code === "EACCES" || err.code === "EPERM") {
    // shared compile cache not writable by current user; safe to skip
    return;
  }
  console.warn(`[postinstall] could not prune OpenClaw compile cache: ${err}`);
}

Alternative: prefix the cache path with the current uid (e.g. /tmp/node-compile-cache-${process.getuid()}/...) so each user has its own cache, sidestepping the shared-cache permission issue entirely.

Repro

  1. As root (or sudo): npm install -g [email protected] --ignore-scripts
  2. Run postinstall: cd /usr/lib/node_modules/openclaw && node scripts/postinstall-bundled-plugins.mjs
  3. As non-root user: npm install -g [email protected] --ignore-scripts
  4. Run postinstall as that user; observe the EACCES WARN

Environment

  • OpenClaw v2026.5.2 (8b2a6e5)
  • Debian 11 (Bitnami AWS instance)
  • Node 24.13.0
  • Compile cache path: /tmp/node-compile-cache/v24.13.0-x64-cf738c9d-0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions