npm-prune.1 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. .TH "NPM\-PRUNE" "1" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-prune\fR \- Remove extraneous packages
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm prune [[<@scope>/]<pkg>\.\.\.] [\-\-production] [\-\-dry\-run] [\-\-json]
  9. .fi
  10. .RE
  11. .SS Description
  12. .P
  13. This command removes "extraneous" packages\. If a package name is
  14. provided, then only packages matching one of the supplied names are
  15. removed\.
  16. .P
  17. Extraneous packages are packages that are not listed on the parent
  18. package's dependencies list\.
  19. .P
  20. If the \fB\-\-production\fP flag is specified or the \fBNODE_ENV\fP environment
  21. variable is set to \fBproduction\fP, this command will remove the packages
  22. specified in your \fBdevDependencies\fP\|\. Setting \fB\-\-no\-production\fP will
  23. negate \fBNODE_ENV\fP being set to \fBproduction\fP\|\.
  24. .P
  25. If the \fB\-\-dry\-run\fP flag is used then no changes will actually be made\.
  26. .P
  27. If the \fB\-\-json\fP flag is used then the changes \fBnpm prune\fP made (or would
  28. have made with \fB\-\-dry\-run\fP) are printed as a JSON object\.
  29. .P
  30. In normal operation with package\-locks enabled, extraneous modules are
  31. pruned automatically when modules are installed and you'll only need
  32. this command with the \fB\-\-production\fP flag\.
  33. .P
  34. If you've disabled package\-locks then extraneous modules will not be removed
  35. and it's up to you to run \fBnpm prune\fP from time\-to\-time to remove them\.
  36. .SS See Also
  37. .RS 0
  38. .IP \(bu 2
  39. npm help uninstall
  40. .IP \(bu 2
  41. npm help folders
  42. .IP \(bu 2
  43. npm help ls
  44. .RE