npm-uninstall.1 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. .TH "NPM-UNINSTALL" "1" "March 2026" "NPM@11.12.0" ""
  2. .SH "NAME"
  3. \fBnpm-uninstall\fR - Remove a package
  4. .SS "Synopsis"
  5. .P
  6. .RS 2
  7. .nf
  8. npm uninstall \[lB]<@scope>/\[rB]<pkg>...
  9. aliases: unlink, remove, rm, r, un
  10. .fi
  11. .RE
  12. .SS "Description"
  13. .P
  14. This uninstalls a package, completely removing everything npm installed on its behalf.
  15. .P
  16. It also removes the package from the \fBdependencies\fR, \fBdevDependencies\fR, \fBoptionalDependencies\fR, and \fBpeerDependencies\fR objects in your \fBpackage.json\fR.
  17. .P
  18. Further, if you have an \fBnpm-shrinkwrap.json\fR or \fBpackage-lock.json\fR, npm will update those files as well.
  19. .P
  20. \fB--no-save\fR will tell npm not to remove the package from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files.
  21. .P
  22. \fB--save\fR or \fB-S\fR will tell npm to remove the package from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, and \fBpackage-lock.json\fR files. This is the default, but you may need to use this if you have for instance \fBsave=false\fR in your \fBnpmrc\fR file
  23. .P
  24. In global mode (ie, with \fB-g\fR or \fB--global\fR appended to the command), it uninstalls the current package context as a global package. \fB--no-save\fR is ignored in this case.
  25. .P
  26. Scope is optional and follows the usual rules for npm help scope.
  27. .SS "Examples"
  28. .P
  29. .RS 2
  30. .nf
  31. npm uninstall sax
  32. .fi
  33. .RE
  34. .P
  35. \fBsax\fR will no longer be in your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files.
  36. .P
  37. .RS 2
  38. .nf
  39. npm uninstall lodash --no-save
  40. .fi
  41. .RE
  42. .P
  43. \fBlodash\fR will not be removed from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files.
  44. .SS "Configuration"
  45. .SS "\fBsave\fR"
  46. .RS 0
  47. .IP \(bu 4
  48. Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR
  49. .IP \(bu 4
  50. Type: Boolean
  51. .RE 0
  52. .P
  53. Save installed packages to a \fBpackage.json\fR file as dependencies.
  54. .P
  55. When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR.
  56. .P
  57. Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR.
  58. .SS "\fBglobal\fR"
  59. .RS 0
  60. .IP \(bu 4
  61. Default: false
  62. .IP \(bu 4
  63. Type: Boolean
  64. .RE 0
  65. .P
  66. Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior.
  67. .RS 0
  68. .IP \(bu 4
  69. packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory.
  70. .IP \(bu 4
  71. bin files are linked to \fB{prefix}/bin\fR
  72. .IP \(bu 4
  73. man pages are linked to \fB{prefix}/share/man\fR
  74. .RE 0
  75. .SS "\fBworkspace\fR"
  76. .RS 0
  77. .IP \(bu 4
  78. Default:
  79. .IP \(bu 4
  80. Type: String (can be set multiple times)
  81. .RE 0
  82. .P
  83. Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
  84. .P
  85. Valid values for the \fBworkspace\fR config are either:
  86. .RS 0
  87. .IP \(bu 4
  88. Workspace names
  89. .IP \(bu 4
  90. Path to a workspace directory
  91. .IP \(bu 4
  92. Path to a parent workspace directory (will result in selecting all workspaces within that folder)
  93. .RE 0
  94. .P
  95. When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
  96. .P
  97. This value is not exported to the environment for child processes.
  98. .SS "\fBworkspaces\fR"
  99. .RS 0
  100. .IP \(bu 4
  101. Default: null
  102. .IP \(bu 4
  103. Type: null or Boolean
  104. .RE 0
  105. .P
  106. Set to true to run the command in the context of \fBall\fR configured workspaces.
  107. .P
  108. Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly:
  109. .RS 0
  110. .IP \(bu 4
  111. Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config.
  112. .RE 0
  113. .P
  114. This value is not exported to the environment for child processes.
  115. .SS "\fBinclude-workspace-root\fR"
  116. .RS 0
  117. .IP \(bu 4
  118. Default: false
  119. .IP \(bu 4
  120. Type: Boolean
  121. .RE 0
  122. .P
  123. Include the workspace root when workspaces are enabled for a command.
  124. .P
  125. When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project.
  126. .P
  127. This value is not exported to the environment for child processes.
  128. .SS "\fBinstall-links\fR"
  129. .RS 0
  130. .IP \(bu 4
  131. Default: false
  132. .IP \(bu 4
  133. Type: Boolean
  134. .RE 0
  135. .P
  136. When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
  137. .SS "See Also"
  138. .RS 0
  139. .IP \(bu 4
  140. npm help prune
  141. .IP \(bu 4
  142. npm help install
  143. .IP \(bu 4
  144. npm help folders
  145. .IP \(bu 4
  146. npm help config
  147. .IP \(bu 4
  148. npm help npmrc
  149. .RE 0