mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-27 03:21:55 -04:00
fix: ensure PNPM_HOME/bin is in PATH during pnpm setup
When upgrading from old pnpm (global bin = PNPM_HOME) to new pnpm (global bin = PNPM_HOME/bin), `pnpm setup` would fail because the spawned `pnpm add -g` checks that the global bin dir is in PATH. Prepend PNPM_HOME/bin to PATH in the spawned process env so the check passes during the transition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
"@pnpm/store.controller": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@pnpm/workspace.project-manifest-reader": "workspace:*",
|
||||
"path-name": "catalog:",
|
||||
"ramda": "catalog:",
|
||||
"render-help": "catalog:",
|
||||
"semver": "catalog:",
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
type ConfigReport,
|
||||
type PathExtenderReport,
|
||||
} from '@pnpm/os.env.path-extender'
|
||||
import PATH from 'path-name'
|
||||
import { renderHelp } from 'render-help'
|
||||
|
||||
export const rcOptionsTypes = (): Record<string, unknown> => ({})
|
||||
@@ -80,11 +81,13 @@ function installCliGlobally (execPath: string, pnpmHomeDir: string): void {
|
||||
})
|
||||
|
||||
try {
|
||||
const binDir = path.join(pnpmHomeDir, 'bin')
|
||||
const { status, error } = spawnSync(execPath, ['add', '-g', `file:${execDir}`], {
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
...process.env,
|
||||
PNPM_HOME: pnpmHomeDir,
|
||||
[PATH]: `${binDir}${path.delimiter}${process.env[PATH] ?? ''}`,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -3524,6 +3524,9 @@ importers:
|
||||
'@pnpm/workspace.project-manifest-reader':
|
||||
specifier: workspace:*
|
||||
version: link:../../../workspace/project-manifest-reader
|
||||
path-name:
|
||||
specifier: 'catalog:'
|
||||
version: 1.0.0
|
||||
ramda:
|
||||
specifier: 'catalog:'
|
||||
version: '@pnpm/ramda@0.28.1'
|
||||
|
||||
Reference in New Issue
Block a user