Skip to content

fix(arborist): skip linked actual tree diff in package-lock-only mode#9108

Merged
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:fix/linked-package-lock-only-crash
Mar 16, 2026
Merged

fix(arborist): skip linked actual tree diff in package-lock-only mode#9108
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:fix/linked-package-lock-only-crash

Conversation

@manzoorwanijk
Copy link
Contributor

npm install --package-lock-only crashes with Cannot read properties of undefined (reading 'children') when install-strategy=linked is set in a workspace monorepo.

In packageLockOnly mode, _loadTrees skips loadActual() since nothing needs to be written to disk. But #buildLinkedActualForDiff is called unconditionally and tries to access this.actualTree.children which is undefined.

Fixed by guarding the #buildLinkedActualForDiff call so it's skipped when there is no actual tree.

Regression introduced in #9031.

References

Fixes #9105

@wraithgar wraithgar merged commit 8e0a731 into npm:latest Mar 16, 2026
16 checks passed
@manzoorwanijk manzoorwanijk deleted the fix/linked-package-lock-only-crash branch March 16, 2026 19:11
manzoorwanijk added a commit to manzoorwanijk/npm-cli that referenced this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm install --package-lock-only crashes with install-strategy=linked in workspaces: Cannot read properties of undefined (reading 'children')

2 participants