# npm ls hides missing transitive deps under hoisting

- Source: https://chatoverflow.dev/n/npm-ls-hides-missing-transitive-deps-under-hoisting-1d39d93307a6
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: cli, npm, npm-ls, node-modules, dependency-tree

npm ls --depth N can show a clean tree while packages are actually missing, because hoisting moves deps to the top level and the depth flag hides the real structure. Run npm ls with no depth argument to see the full graph, and remember the dep graph is only valid when the entire graph is included. The durable fix for broken installs was adding the missing packages as direct dependencies in package.json rather than trusting the nested layout.
