Conversation
Previously, globally installed binaries were placed directly in PNPM_HOME, which also contains internal directories (global/, store/). This polluted shell autocompletion with non-executable entries. Now binaries are stored in PNPM_HOME/bin, keeping the PATH clean. Closes #10986 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Once @pnpm/os.env.path-extender supports proxyVarSubDir, setup should use it to properly set PNPM_HOME and add $PNPM_HOME/bin to PATH. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update setup to use proxyVarSubDir: 'bin' so shell config generates: export PNPM_HOME="/path/to/pnpm" PATH="$PNPM_HOME/bin:$PATH" This properly sets PNPM_HOME while keeping only the bin subdir on PATH. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts pnpm’s global binary layout so that globally installed executables live under PNPM_HOME/bin (instead of directly in PNPM_HOME), and updates related commands/config to match—reducing PATH/autocomplete “pollution” from internal directories.
Changes:
- Change the global bin directory default to
<data-dir>/binand update PATH/setup behavior accordingly. - Update
pnpm setupandpnpm self-updateto link/use the newbinsubdirectory. - Improve the
GLOBAL_BIN_DIR_NOT_IN_PATHerror by adding apnpm setuphint, and bump@pnpm/os.env.path-extenderto v3.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Bumps @pnpm/os.env.path-extender catalog version to support new setup behavior. |
| pnpm-lock.yaml | Lockfile updates for the @pnpm/os.env.path-extender@3 upgrade. |
| engine/runtime/commands/src/env/utils.ts | Updates node exec path helper to use the bin/ subdirectory. |
| engine/pm/commands/src/setup/setup.ts | Makes pnpm setup add <PNPM_HOME>/bin to PATH and writes pnpx shims into bin/. |
| engine/pm/commands/src/self-updater/selfUpdate.ts | Links self-updated pnpm binaries into <PNPM_HOME>/bin. |
| config/reader/test/index.ts | Adjusts config reader tests to expect PATH to include <PNPM_HOME>/bin. |
| config/reader/src/index.ts | Changes global default config.bin fallback to <data-dir>/bin. |
| config/reader/src/checkGlobalBinDir.ts | Adds a hint suggesting pnpm setup when the global bin dir isn’t in PATH. |
| .changeset/fix-global-bin-subdir.md | Documents the behavior change and instructs users to rerun pnpm setup. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tests now add pnpmHomeDir/bin to PATH instead of pnpmHomeDir, matching the new bin directory layout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The prepareOptions helper and the "without package.json" test now set bin to pnpmHomeDir/bin to match the new layout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Derive pnpmHomeDir from the passed env instead of process.env, so pnpmHomeDir and bin are always consistent (even in tests/embedded usage) - Fix misleading error message: "pnpm home directory" → "global bin directory" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- global.ts: PATH now includes pnpmHome/bin, bin existence checks use pnpmHome/bin/ prefix - uninstall.ts: PNPM_HOME points to parent dir, not the bin dir - root.ts: PATH includes pnpmHome/bin - bin.ts: PATH and expected output use pnpmHome/bin Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10986
PNPM_HOME/bininstead of directly inPNPM_HOMEpnpm setupnow addsPNPM_HOME/binto PATH instead ofPNPM_HOMEpnpm self-updatelinks bins to thebinsubdirectoryGLOBAL_BIN_DIR_NOT_IN_PATHerror suggestingpnpm setupThis prevents internal directories like
global/andstore/from appearing in shell autocompletion whenPNPM_HOMEis on PATH.Note: After upgrading, users need to run
pnpm setupto update their shell configuration. TheGLOBAL_BIN_DIR_NOT_IN_PATHerror now includes a hint about this.Note:
pnpm setupno longer sets thePNPM_HOMEenvironment variable in shell config (it only adds the bin dir to PATH).pnpmdetermines its data directory viagetDataDir()which uses platform-specific defaults.Test plan
pnpm setupadds<data-dir>/binto PATHpnpm add -g <pkg>places binaries in<data-dir>/binpnpm self-updatelinks to the bin subdirectory🤖 Generated with Claude Code
Related PR: