diff --git a/.changeset/silver-bananas-lie.md b/.changeset/silver-bananas-lie.md new file mode 100644 index 0000000000..84ea05cfbe --- /dev/null +++ b/.changeset/silver-bananas-lie.md @@ -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. diff --git a/pkg-manager/core/src/install/index.ts b/pkg-manager/core/src/install/index.ts index 17f858cd74..f6fc3efc86 100644 --- a/pkg-manager/core/src/install/index.ts +++ b/pkg-manager/core/src/install/index.ts @@ -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