commands.sh

npm prune

all

Remove extraneous packages from `node_modules`. Note: Extraneous packages are those present in the node_modules folder that are not listed as any package's dependency list.

More info →

Examples (5)

Remove all extraneous packages not listed in dependencies

Remove extraneous packages and devDependencies (useful for production builds)

npm prune --production

Show what would be removed without making any changes

npm prune --dry-run

Output the changes as JSON

npm prune --json

Remove specific packages by name

npm prune package_name
made by @shridhargupta | data from tldr-pages