Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

corepack enable fails: permission denied while creating the pnpm link

ErrorInternal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'

Short answer

corepack enable writes small link files for yarn and pnpm next to your node binary. If that folder, often /usr/local/bin, is not writable by your user, the command stops with EACCES. Point it at a folder you own with --install-directory, or run it once as an admin. A read-only file system also makes it fail.

  • Applies to Node.js 22, Node.js 24, macOS 15, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out which folder corepack wants to write to and whether your user may write there.

    which node
    ls -ld "$(dirname "$(which node)")"
  2. 2Match what you see, then jump to its fix

    1. 1EACCES on a symlink into /usr/local/bin (or another system folder)The folder that holds node is owned by rootFix
    2. 2A failure even when run as an administratorThe file system holding corepack is read-onlyFix

What does the error look like?

  • Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'

Cause 1 of 2

The folder that holds node is owned by root

1Check

The README says corepack enable installs the yarn and pnpm shims on your path. It puts them where Node.js is installed, so a root-owned folder blocks a normal user. The check above shows the owner and mode.

ls -ld /usr/local/bin

2Fix

Create a folder you own, put it on your PATH, and tell corepack to place the shims there with --install-directory.

mkdir -p ~/.local/bin
corepack enable --install-directory ~/.local/bin
# make sure this line is in ~/.zshrc or ~/.bashrc
export PATH="$HOME/.local/bin:$PATH"

3Verify

Open a new shell and ask for the package manager version.

which pnpm
pnpm --version

Confirmed by github.com

Did this fix it?

Cause 2 of 2

The file system holding corepack is read-only

1Check

The README warns that corepack enable fails when the file system holding the corepack binary is read-only.

mount | grep -E " on (/|/usr) "

2Fix

Use --install-directory with a folder on a writable file system, as in the first cause. As the README suggests, a shell alias that calls corepack is another way when nothing on the system path can be written.

mkdir -p "$HOME/.local/bin"
corepack enable --install-directory "$HOME/.local/bin"

3Verify

The shim exists and points to corepack.

ls -l ~/.local/bin/pnpm

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Prefer a Node.js install that your own user owns (a version manager such as nvm), so global tools never need root.
  • Keep one folder of your own on PATH for command shims.
  • Record the package manager in the packageManager field so everyone gets the same version.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.