.TH "NPM\-PRUNE" "1" "November 2023" "9.2.0" .SH "NAME" \fBnpm-prune\fR .SH Synopsis .SH Description .P This command removes "extraneous" packages\. If a package name is provided, .br then only packages matching one of the supplied names are removed\. .P Extraneous packages are those present in the \fBnode_modules\fP folder that are .br not listed as any package's dependency list\. .P If the \fB\-\-production\fP flag is specified or the \fBNODE_ENV\fP environment .br variable is set to \fBproduction\fP, this command will remove the packages .br specified in your \fBdevDependencies\fP\|\. Setting \fB\-\-no\-production\fP will negate .br \fBNODE_ENV\fP being set to \fBproduction\fP\|\. .P If the \fB\-\-dry\-run\fP flag is used then no changes will actually be made\. .P If the \fB\-\-json\fP flag is used, then the changes \fBnpm prune\fP made (or would .br have made with \fB\-\-dry\-run\fP) are printed as a JSON object\. .P In normal operation, extraneous modules are pruned automatically, so you'll .br only need this command with the \fB\-\-production\fP flag\. However, in the real .br world, operation is not always "normal"\. When crashes or mistakes happen, .br this command can help clean up any resulting garbage\. .SH Configuration .SH See Also .RS 1 .IP \(bu 2 npm uninstall .IP \(bu 2 npm folders .IP \(bu 2 npm ls .RE