diff --git a/.changeset/grumpy-shrimps-hunt.md b/.changeset/grumpy-shrimps-hunt.md new file mode 100644 index 00000000000..9354621a020 --- /dev/null +++ b/.changeset/grumpy-shrimps-hunt.md @@ -0,0 +1,6 @@ +--- +"@pnpm/constants": patch +"pnpm": patch +--- + +Change lockfile version back to 6.0 as previous versions of pnpm fail to parse the version correctly. diff --git a/lockfile/lockfile-file/src/read.ts b/lockfile/lockfile-file/src/read.ts index 7ae7adfce45..5c7bde19874 100644 --- a/lockfile/lockfile-file/src/read.ts +++ b/lockfile/lockfile-file/src/read.ts @@ -109,7 +109,7 @@ async function _read ( opts.wantedVersions.length === 0 || opts.wantedVersions.some((wantedVersion) => { if (semver.major(lockfileSemver) !== semver.major(comverToSemver(wantedVersion))) return false - if (semver.gt(lockfileSemver, comverToSemver(wantedVersion))) { + if (lockfile.lockfileVersion !== '6.1' && semver.gt(lockfileSemver, comverToSemver(wantedVersion))) { logger.warn({ message: `Your ${WANTED_LOCKFILE} was generated by a newer version of pnpm. ` + `It is a compatible version but it might get downgraded to version ${wantedVersion}`, diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index 7cb3ee03ee0..d0abf24177f 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -1,6 +1,6 @@ export const WANTED_LOCKFILE = 'pnpm-lock.yaml' export const LOCKFILE_VERSION = 5.4 -export const LOCKFILE_VERSION_V6 = '6.1' +export const LOCKFILE_VERSION_V6 = '6.0' export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}` export const LAYOUT_VERSION = 5 diff --git a/pkg-manager/core/src/install/index.ts b/pkg-manager/core/src/install/index.ts index 9e296f5675b..c56c8bd84fc 100644 --- a/pkg-manager/core/src/install/index.ts +++ b/pkg-manager/core/src/install/index.ts @@ -370,7 +370,8 @@ export async function mutateModules ( ctx.existsWantedLockfile && ( ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION || - ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION_V6 + ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION_V6 || + ctx.wantedLockfile.lockfileVersion === '6.1' ) && await allProjectsAreUpToDate(Object.values(ctx.projects), { autoInstallPeers: opts.autoInstallPeers,