fix: don't crash on lockfile with no packages field (#5557)

close #5553
This commit is contained in:
Zoltan Kochan
2022-10-27 22:48:47 +03:00
committed by GitHub
parent c8142ffb0a
commit 3c36e7e021
2 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/resolve-dependencies": patch
"pnpm": patch
---
Don't crash on lockfile with no packages field [#5553](https://github.com/pnpm/pnpm/issues/5553).

View File

@@ -332,8 +332,8 @@ async function finishLockfileUpdates (
// TODO: try to cover with unit test the case when entry is no longer available in lockfile
// It is an edge that probably happens if the entry is removed during lockfile prune
if (requiresBuild && newLockfile.packages![depPath]) {
newLockfile.packages![depPath].requiresBuild = true
if (requiresBuild && newLockfile.packages?.[depPath]) {
newLockfile.packages[depPath].requiresBuild = true
}
}))
}