diff --git a/apps/lockfile-explorer/src/graph/lfxGraphLoader.ts b/apps/lockfile-explorer/src/graph/lfxGraphLoader.ts index 732548d974..3db72dc314 100644 --- a/apps/lockfile-explorer/src/graph/lfxGraphLoader.ts +++ b/apps/lockfile-explorer/src/graph/lfxGraphLoader.ts @@ -21,6 +21,8 @@ import * as lockfilePath from './lockfilePath'; type PnpmLockfileVersion = 54 | 60 | 90; type PeerDependenciesMeta = lockfileTypes.LockfilePackageInfo['peerDependenciesMeta']; +let hasWarnedAboutOutdatedFormat: boolean = false; + function createPackageLockfileDependency(options: { name: string; versionPath: string; @@ -329,9 +331,16 @@ function createPackageLockfileEntry(options: { slashlessRawEntryId = rawEntryId; } else { if (!rawEntryId.startsWith('/')) { - throw new Error('Expecting leading "/" in path: ' + JSON.stringify(rawEntryId)); + if (!hasWarnedAboutOutdatedFormat) { + console.warn( + 'Your pnpm-lock.yaml contains outdated version formats. Please run "rush update --full" to fix this issue.' + ); + hasWarnedAboutOutdatedFormat = true; + } + slashlessRawEntryId = rawEntryId; + } else { + slashlessRawEntryId = rawEntryId.substring(1); } - slashlessRawEntryId = rawEntryId.substring(1); } let dotPnpmSubfolder: string; diff --git a/common/changes/@rushstack/lockfile-explorer/fix-lockfile-version-diffs_2026-02-20-02-06.json b/common/changes/@rushstack/lockfile-explorer/fix-lockfile-version-diffs_2026-02-20-02-06.json new file mode 100644 index 0000000000..428456785c --- /dev/null +++ b/common/changes/@rushstack/lockfile-explorer/fix-lockfile-version-diffs_2026-02-20-02-06.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/lockfile-explorer", + "comment": "Add user-friendly warning for outdated pnpm-lock.yaml instead of throwing an error. The warning suggests running \"rush update --full\" to fix the issue.", + "type": "patch" + } + ], + "packageName": "@rushstack/lockfile-explorer" +} \ No newline at end of file