Permission denied error when trying to install pnpm via Corepack as node user
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 8.6k
- Forks
- 2k
- Avg merge
- 10h 19m
- Merged PRs (30d)
- 16
Description
Environment
- Node.js Version: 16.15.0
- Image Tag: lts-alpine
Expected Behavior
I should be able to install pnpm using Corepack as a non-privilegied user.
Current Behavior
When I try to install pnpm via Corepack (corepack enable) as non-privilegied user (-u node), I get the following error:
/app $ corepack enable
Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
/app $
Running corepack enable as root work as expected.
docker run -it -v $(pwd):/app node:lts-alpine /bin/sh

Steps to Reproduce
-
Create an empty project with the following
package.json. ThepackageManagerproperty is important here.{ "name": "docker-node-pnpm", "version": "1.0.0", "private": true, "packageManager": "pnpm@7.1.7" } -
Run the container as a non-privilegied user:
docker run -it -v $(pwd):/app -u node node:lts-alpine /bin/sh -
cd /app -
corepack enable<-- This should fail -
corepack prepare -
pnpm install
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the documented node:lts-alpine Docker commands and the non-privileged -u node user. Review how the image configures Corepack and writable paths; done means corepack enable succeeds as node and the documented pnpm install flow works without root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, node.js
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100