[node] - Install pnpm as non-root user to prevent root-owned npm cache#1625
Open
brianhelba wants to merge 1 commit intodevcontainers:mainfrom
Open
[node] - Install pnpm as non-root user to prevent root-owned npm cache#1625brianhelba wants to merge 1 commit intodevcontainers:mainfrom
brianhelba wants to merge 1 commit intodevcontainers:mainfrom
Conversation
Currently, the pnpm installation block runs `npm install -g pnpm` in
a bare subshell as root, unlike every other npm/nvm operation in the
script which uses `su ${USERNAME}`. This causes the npm cache directory
to be created owned by `root:root`, leading to `EACCES` errors for the
non-root user on subsequent npm operations.
This is particularly reproducible on macOS with Rosetta 2 emulation,
where the cache directory may not already exist from prior steps.
Note, the explicit setting of proxy env vars (`http_proxy`, `https_proxy`,
`no_proxy`) is likely a workaround for npm/cli#6835.
No other commands in this script use that workaround anymore, so this change
uses the same `su` syntax as all other commands.
brianhelba
added a commit
to kitware-resonant/cookiecutter-resonant
that referenced
this pull request
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the pnpm installation block runs
npm install -g pnpmin a bare subshell as root, unlike every other npm/nvm operation in the script which usessu ${USERNAME}. This causes the npm cache directory to be created owned byroot:root, leading toEACCESerrors for the non-root user on subsequent npm operations.This is particularly reproducible on macOS with Rosetta 2 emulation, where the cache directory may not already exist from prior steps.
Note, the explicit setting of proxy env vars (
http_proxy,https_proxy,no_proxy) is likely a workaround for npm/cli#6835. No other commands in this script use that workaround anymore, so this change uses the samesusyntax as all other commands.