Skip to content

devcontainer: fix pnpm install EACCES on first container creation#2346

Merged
curtisman merged 1 commit into
mainfrom
agents/devcontainer-pnpm-install-error-fix
May 14, 2026
Merged

devcontainer: fix pnpm install EACCES on first container creation#2346
curtisman merged 1 commit into
mainfrom
agents/devcontainer-pnpm-install-error-fix

Conversation

@curtisman
Copy link
Copy Markdown
Member

Problem

On first creation of the devcontainer, pnpm install fails with EACCES: permission denied writing into ts/node_modules.

Root cause

.devcontainer/devcontainer.json mounts three Docker named volumes:

  • ${containerWorkspaceFolder}/ts/node_modules
  • /home/codespace/.local/share/pnpm/store
  • /home/codespace/.claude

Docker creates the mount-point directories owned by root:root. The container's remoteUser is codespace (UID 1000), so when post-create.sh runs pnpm install as codespace it can't write into ts/node_modules (or populate the global pnpm store).

Fix

  • .devcontainer/scripts/post-create.sh: before running pnpm install, sudo chown -R codespace:codespace the three mounted volume paths. The ts workspace path is discovered dynamically so worktrees keep working.
  • .devcontainer/README.md: document the symptom and a manual recovery command in the Troubleshooting section.

Reviewer notes

  • No code or build changes; only the devcontainer shell script and its README.
  • Behaviour is a no-op on subsequent container starts (paths already owned by codespace).
  • Verified via inspection; full validation requires rebuilding the devcontainer (Dev Containers: Rebuild Container).

Docker named volumes mounted at ts/node_modules, the pnpm global store, and the Claude config directory are created as root:root, which prevented the non-root codespace user from running pnpm install on first container creation.

post-create.sh now sudo chowns these mount points to codespace before invoking pnpm install. README gains a troubleshooting entry with manual recovery steps.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@curtisman curtisman requested a deployment to development-fork May 14, 2026 21:11 — with GitHub Actions Waiting
@curtisman curtisman requested a deployment to development-fork May 14, 2026 21:11 — with GitHub Actions Waiting
@curtisman curtisman added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit 47fe460 May 14, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant