nodejs / nodejs/corepack

Permission issue on windows.

Open
#71 20 comments 34 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
279
Avg merge
1h 47m
Merged PRs (30d)
2

Description

The node.js installer on windows (*.msi) will choose C:\Program Files\nodejs by default to place node.exe, npm and corepack. As you may know this place requires admin permission, the installer will bring up the UAC and ask for it once.

At the same time, npm (and pnpm) works well here because it will install packages to %appdata%\npm, where no permission is needed.

However, corepack will install pnpm to the same place as corepack by default (which is C:\Program Files\nodejs\node_modules\corepack. This causes permission issue:

> corepack enable
Internal Error: EPERM ....

A workaround is using --install-directory to manually change the install folder to some place without permission, for example %appdata%\corepack.

I hope corepack would use places like %appdata%\corepack on windows to avoid potential EPERM issues.

(BTW, the node.js installer for other systems are likely to choose a place with high permission. It is really an issue on macOS because it generally forbids installing anything globally, in which case users must use brew to correctly install it to a safe place. However I'm not expecting you to fix the installer logic and this is out of scope.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing corepack enable on Windows with the default Node.js installer location, then inspect the existing --install-directory behavior. Done means Corepack can enable pnpm in a user-writable location such as %appdata%\corepack without an EPERM error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.