Skip to content

fix(ls): handle missing root deps with --workspaces=false - #10158

Open
lazerg wants to merge 2 commits into
npm:latestfrom
lazerg:fix/10157-ls-workspaces-false-null-edge
Open

lazerg wants to merge 2 commits into
npm:latestfrom
lazerg:fix/10157-ls-workspaces-false-null-edge

Conversation

@lazerg

@lazerg lazerg commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

In a workspaces project, npm ls --workspaces=false crashes with Cannot read properties of null (reading 'isWorkspace') whenever the root has a dependency that isn't installed, whether it's missing, omitted, or skipped as a platform-specific optional dep. The --workspaces=false check in filterBySelectedWorkspaces read edge.to.isWorkspace without checking for a null edge.to, which is what a missing dependency's edge has. The other checks in that function already guard for it, so this adds the same guard. The output now matches plain npm ls without the workspaces.

Testing

Added a --workspaces=false version of the existing "workspace and missing optional dep" test. It crashes before the change and passes after. The full suite passes locally.

References

Fixes #10157

@lazerg
lazerg requested a review from a team as a code owner October 23, 2026 09:37
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 ls --workspaces=false crashes with an uninstalled root dependency

2 participants