fix: store prune should not fail if the store contains Node.js (#10193)

close #10131
This commit is contained in:
Zoltan Kochan
2025-11-17 23:45:48 +01:00
committed by GitHub
parent 2464485700
commit 09bb8dbd8c
2 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/package-store": patch
"pnpm": patch
---
`pnpm store prune` should not fail if the store contains Node.js packages [#10131](https://github.com/pnpm/pnpm/issues/10131).

View File

@@ -75,7 +75,8 @@ export async function prune ({ cacheDir, storeDir }: PruneOptions, removeAlienFi
let pkgCounter = 0
await Promise.all(pkgIndexFiles.map(async (pkgIndexFilePath) => {
const { files: pkgFilesIndex } = await readV8FileStrictAsync<PackageFilesIndex>(pkgIndexFilePath)
if (removedHashes.has(pkgFilesIndex['package.json'].integrity)) {
// TODO: implement prune of Node.js packages, they don't have a package.json file
if (pkgFilesIndex['package.json'] && removedHashes.has(pkgFilesIndex['package.json'].integrity)) {
await fs.unlink(pkgIndexFilePath)
pkgCounter++
}