fix: honor devEngines.packageManager.onFail=error (#252)

Export pnpm_config_pm_on_fail=download so the bootstrap pnpm switches to
the version pinned in devEngines.packageManager instead of throwing
BAD_PM_VERSION on the user's first invocation.
This commit is contained in:
Zoltan Kochan
2026-05-10 23:30:57 +02:00
parent 91ab88e261
commit 052c4ffb7d
3 changed files with 123 additions and 67 deletions

View File

@@ -67,6 +67,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise<SelfInstallerRes
addPath(pnpmHome)
addPath(path.join(pnpmHome, 'bin'))
exportVariable('PNPM_HOME', pnpmHome)
// Force pnpm to honor manage-package-manager-versions even when the project
// pins `devEngines.packageManager.onFail = "error"`. Without this override
// the bootstrap pnpm errors with BAD_PM_VERSION instead of switching to the
// requested version on the user's first invocation (issue #252).
exportVariable('pnpm_config_pm_on_fail', 'download')
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
if (process.platform !== 'win32') {