← Back to PRs

#7938: fix(agents): install node skills with --prefix CONFIG_DIR for non-root/Docker

by logozorro open 2026-02-03 10:53 View on GitHub →
agents stale
## Problem When using the dashboard **Install** button for node-based skills (e.g. ClawHub), the install runs `npm install -g` (or pnpm/yarn/bun global). In Docker and other non-root environments this fails with **EACCES** because the process cannot write to `/usr/local/lib/node_modules`. ## Solution Use `npm install --prefix CONFIG_DIR` (and `pnpm add --prefix CONFIG_DIR`) so packages are installed into the OpenClaw config directory, which is writable by the running user. For yarn/bun we use `npm install --prefix CONFIG_DIR` since they don't support a prefix for `add`/global install. ## Result - Dashboard Install works in Docker (e.g. Coolify) and when running as non-root. - Installed packages live under `CONFIG_DIR/node_modules` and persist with the rest of config. - No behavior change for users who already run as root (installs just go to config dir instead of global). Made with [Cursor](https://cursor.com) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR changes how node-based skill installs are executed in `src/agents/skills-install.ts`, replacing global installs (e.g. `npm install -g`, `pnpm add -g`, `yarn global add`, `bun add -g`) with prefix-based installs targeting `CONFIG_DIR` to avoid EACCES failures in Docker/non-root environments. The approach fits the existing skills installer architecture by only adjusting the command construction for `SkillInstallSpec.kind === "node"`, leaving other installer kinds (brew/go/uv/download) unchanged and continuing to use `runCommandWithTimeout` for execution. Main concern: prefix installs don’t automatically expose installed CLIs on PATH, so node skill installs may still not satisfy `hasBinary(...)`/`bins` expectations unless the runtime PATH is updated to include `CONFIG_DIR/node_modules/.bin` (or another strategy is used to surface executables). <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge but may not fully achieve the intended “install makes tool available” behavior for node-based skills. - The change is small and scoped, but switching from global installs to prefix installs alters the semantics: packages will install into `CONFIG_DIR/node_modules` without necessarily exposing their binaries on PATH, which can cause node skill installs to still appear missing or be unusable unless PATH handling is addressed elsewhere. - src/agents/skills-install.ts (node installer command construction and how installed binaries are expected to be discovered/used) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs