npm prune

Category: Node.js & npm/yarn

npm prune

Remove packages from node_modules that are not listed in package.json

Deletes packages from node_modules that are installed but not listed in package.json — cleans up leftovers from manual deletions or old installs.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.