Skip to content

pnpm: persist global data and add to path#6762

Open
jack-mil wants to merge 3 commits intoScoopInstaller:masterfrom
jack-mil:fix/pnpm
Open

pnpm: persist global data and add to path#6762
jack-mil wants to merge 3 commits intoScoopInstaller:masterfrom
jack-mil:fix/pnpm

Conversation

@jack-mil
Copy link
Copy Markdown
Contributor

Following off of the similar python and rustup manifests, I have updated pnpm to make use of the $PNPM_HOME env variable in order to install global packages or cli utilities into a scoop-managed and persisted directory (instead of the default on windows: ~/AppData/Local/pnpm/global

An alternative approach would be to:

a) Leave the pnpm default global directory as is, and simply add ~/AppData/Local/pnpm/global to PATH when installing the manifest. This would also fix issues like #6713. But the application data would not be contained within the ~/scoop folder (generally prefered).

b) Instruct users to run pnpm setup after installation, which will
- create a home directory for the pnpm CLI (~/AppData/Local/pnpm/global)
- adds the pnpm home directory to the PATH environment variable
- copies the pnpm executable to the pnpm home directory
In this case however, scoop will no longer manage pnpm at all, and it will be no different than installing manually (without scoop).

Note: $PNPM_HOME cannot be set to "$persist_dir\pnpm_data" because it seems that pnpm checks at runtime if the exact directory $PNPM_HOME is in $PATH, and doesn't follow symlinks.

Fixes: #6713

  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

@github-actions
Copy link
Copy Markdown
Contributor

All changes look good.

Wait for review from human collaborators.

pnpm

  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate

@jack-mil
Copy link
Copy Markdown
Contributor Author

I realize that this is a pretty major breaking change to those using this manifest already. Migration or at the very least a warning on updating is probably required. I would need advice on what is the canonical way to do that; if this change is even deemed necessary in the first place.

@Lutra-Fs
Copy link
Copy Markdown
Member

See #6462 (comment)

@jack-mil
Copy link
Copy Markdown
Contributor Author

I have finally gotten to this. I am not a pnpm user, so I don't know if this change is even wanted across the board. This manifest will have similar behavior to other scoop apps now, and at-least one issue has a desire to manage the global installation environment.

@HUMORCE
Copy link
Copy Markdown
Member

HUMORCE commented Jul 10, 2025

For #6713, We should provide script similar pnpm setup, i.e.:

  1. Set $env:PNPM_HOME to $env:LOCALAPPDATA\pnpm
  2. Add $env:PNPM_HOME to $env:PATH

cacheDir and stateDir can set by pnpm config(config file), but the location of config file of pnpm(Windows) is fixed $env:LOCALAPPDATA\pnpm\config\rc.

pnpm self-update will install its newer version to $env:PNPM_HOME, when current version is standalone executable(Scoop provided), instead, use a NPM package manager will not caused this issue.


Personally, I prefer to install pnpm or other global packages via bun add -g <package>. npm add -g pnpm are recommend by pnpm official document. I understand that users need persistence to migrate/backup their data files quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: pnpm does not add a global bin directory

3 participants