fix: print a hint about the package-manager-strict setting (#7960)

close #7956
This commit is contained in:
Zoltan Kochan authored and GitHub committed 2024-04-18 13:18:30 +02:00
1 parent d87d36e82e
commit a80b539c36
2 files changed
+9 -1

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@pnpm/cli-utils": patch
"pnpm": patch
---
Print a hint about the `package-manager-strict` setting, when pnpm doesn't match the version specified in the `packageManager` field in `package.json`.
+3 -1
View File
@@ -38,7 +38,9 @@ export function packageIsInstallable (
if (pmVersion && pnpmVersion && pmVersion !== pnpmVersion) {
const msg = `This project is configured to use v${pmVersion} of pnpm. Your current pnpm is v${pnpmVersion}`
if (opts.packageManagerStrict) {
throw new PnpmError('BAD_PM_VERSION', msg)
throw new PnpmError('BAD_PM_VERSION', msg, {
hint: 'If you want to bypass this version check, you can set the "package-manager-strict" configuration to "false" or set the "COREPACK_ENABLE_STRICT" environment variable to "0"',
})
} else {
globalWarn(msg)
}