fix: also create alias links in $PNPM_HOME/bin/

self-update links bins to $PNPM_HOME/bin/ which comes first in PATH.
Without alias links there, the broken pnx shim from self-update
(pointing to placeholder files) takes precedence over our .bin/pnx.
This commit is contained in:
Zoltan Kochan
2026-03-26 19:14:42 +01:00
parent 188c8307ce
commit 76bfe9d01c
2 changed files with 127 additions and 121 deletions

240
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -62,8 +62,14 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
}
// Create pn/pnx alias bin links if the installed version supports them
// (pnpm v11+ adds pn and pnx as short aliases)
// (pnpm v11+ adds pn and pnx as short aliases).
// self-update links bins to $PNPM_HOME/bin/ which is also on PATH,
// so we must create aliases in both directories.
await ensureAliasLinks(pnpmHome, standalone)
const pnpmBinDir = path.join(pnpmHome, 'bin')
if (existsSync(pnpmBinDir)) {
await ensureAliasLinks(pnpmBinDir, standalone)
}
return 0
}