fix: make the FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE error and hint messages more clear (#6304)

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
Daniel-Khodabakhsh
2023-03-29 12:51:33 -07:00
committed by GitHub
parent 9fd0e375e9
commit e87754df1f
4 changed files with 18 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---
Improve the outdated lockfile error message [#6304](https://github.com/pnpm/pnpm/pull/6304).

View File

@@ -351,9 +351,16 @@ export async function mutateModules (
)
) {
if (needsFullResolution) {
throw new PnpmError('FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE', 'Cannot perform a frozen installation because the lockfile needs updates', {
hint: 'Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"',
})
throw new PnpmError('FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE',
'Cannot perform a frozen installation because the version of the lockfile is incompatible with this version of pnpm',
{
hint: `Try either:
1. Aligning the version of pnpm that generated the lockfile with the version that installs from it, or
2. Migrating the lockfile so that it is compatible with the newer version of pnpm, or
3. Using "pnpm install --no-frozen-lockfile".
Note that in CI environments, this setting is enabled by default.`,
}
)
}
if (opts.lockfileOnly) {
// The lockfile will only be changed if the workspace will have new projects with no dependencies.

View File

@@ -95,7 +95,7 @@ test('versions are replaced with versions specified through overrides option', a
}, await testDefaults({ frozenLockfile: true, overrides }))
).rejects.toThrow(
new PnpmError('FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE',
'Cannot perform a frozen installation because the lockfile needs updates'
'Cannot perform a frozen installation because the version of the lockfile is incompatible with this version of pnpm'
)
)
})

View File

@@ -89,7 +89,7 @@ test('manifests are extended with fields specified by packageExtensions', async
}, await testDefaults({ frozenLockfile: true, packageExtensions }))
).rejects.toThrow(
new PnpmError('FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE',
'Cannot perform a frozen installation because the lockfile needs updates'
'Cannot perform a frozen installation because the version of the lockfile is incompatible with this version of pnpm'
)
)
})