corepack enable "EACCES permission denied" - Fix Shim Install in CI
corepack enable writes yarn/pnpm shims into Node’s install bin directory. If that directory is root-owned and the build runs as non-root, the symlink creation fails with EACCES.
What this error means
corepack enable errors with EACCES while creating shims in a Node bin path. It is common in Docker images where Node is installed as root but the build user is non-root.
Corepack output
Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js'
'/usr/local/bin/pnpm'Common causes
The Node bin directory is owned by root
Corepack tries to symlink shims into e.g. /usr/local/bin, which the non-root build user cannot modify.
corepack enable run without sufficient privilege
In CI the step runs as the build user; without ownership or a writable install dir, shim creation is denied.
How to fix it
Enable Corepack with the right privilege or target
Either run enable as root in the image build, or point shims at a user-writable dir.
Dockerfile / Terminal
# in a Dockerfile, while still root:
RUN corepack enable
# or as non-root, install shims to a writable dir:
corepack enable --install-directory "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"Fix ownership of the bin path
- In images, run
corepack enableduring the root-privileged build phase. - For ad hoc CI, use
--install-directorypointing at a user-owned PATH entry. - Avoid sudo for per-run enabling; bake it into the image instead.
How to prevent it
- Enable Corepack at image-build time as root.
- Use a user-writable install directory for non-root runs.
- Keep package-manager provisioning in the image, not per-job.
Related guides
Corepack "Signature verification failed" / Cannot Download - Fix in CIFix Corepack errors in CI - "Cannot find matching keyid" / signature verification failed or a failed package-…
npm EACCES "permission denied" on the npm cache - Fix in CIFix npm "EACCES: permission denied" errors on ~/.npm or node_modules in CI and Docker - caused by files owned…