fix: don't try to fix a lockfile that did not exist (#6091)

This commit is contained in:
Zoltan Kochan
2023-02-16 13:29:42 +02:00
committed by GitHub
parent 2241f77adf
commit f17ca4218d
2 changed files with 15 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---
Don't retry installation if the integrity checksum of a package failed and no lockfile was present.

View File

@@ -385,7 +385,11 @@ export async function mutateModules (
} catch (error: any) { // eslint-disable-line
if (
frozenLockfile ||
error.code !== 'ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY' && !BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)
(
error.code !== 'ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY' &&
!BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)
) ||
(!ctx.existsWantedLockfile && !ctx.existsCurrentLockfile)
) throw error
if (BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)) {
needsFullResolution = true
@@ -1234,7 +1238,10 @@ const installInContext: InstallFunction = async (projects, ctx, opts) => {
}
return await _installInContext(projects, ctx, opts)
} catch (error: any) { // eslint-disable-line
if (!BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code)) throw error
if (
!BROKEN_LOCKFILE_INTEGRITY_ERRORS.has(error.code) ||
(!ctx.existsWantedLockfile && !ctx.existsCurrentLockfile)
) throw error
opts.needsFullResolution = true
// Ideally, we would not update but currently there is no other way to redownload the integrity of the package
opts.update = true