1NPM-UNINSTALL(1) NPM-UNINSTALL(1)
2
3
4
6 npm-uninstall - Remove a package
7
8 Synopsis
9 npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|--no-save]
10
11 aliases: remove, rm, r, un, unlink
12
13 Description
14 This uninstalls a package, completely removing everything npm installed
15 on its behalf.
16
17 It also removes the package from the dependencies, devDependencies, op‐
18 tionalDependencies, and peerDependencies objects in your package.json.
19
20 Futher, if you have an npm-shrinkwrap.json or package-lock.json, npm
21 will update those files as well.
22
23 --no-save will tell npm not to remove the package from your pack‐
24 age.json, npm-shrinkwrap.json, or package-lock.json files.
25
26 --save or -S will tell npm to remove the package from your pack‐
27 age.json, npm-shrinkwrap.json, and package-lock.json files. This is
28 the default, but you may need to use this if you have for instance
29 save=false in your npmrc file
30
31 In global mode (ie, with -g or --global appended to the command), it
32 uninstalls the current package context as a global package. --no-save
33 is ignored in this case.
34
35 Scope is optional and follows the usual rules for npm help scope.
36
37 Examples
38 npm uninstall sax
39
40 sax will no longer be in your package.json, npm-shrinkwrap.json, or
41 package-lock.json files.
42
43 npm uninstall lodash --no-save
44
45 lodash will not be removed from your package.json, npm-shrinkwrap.json,
46 or package-lock.json files.
47
48 Configuration
49 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
50 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
51 tions.js -->
52
53 save
54 • Default: true
55
56 • Type: Boolean
57
58
59 Save installed packages to a package.json file as dependencies.
60
61 When used with the npm rm command, removes the dependency from pack‐
62 age.json. <!-- automatically generated, do not edit manually --> <!--
63 see lib/utils/config/definitions.js -->
64
65
66 workspace
67 • Default:
68
69 • Type: String (can be set multiple times)
70
71
72 Enable running a command in the context of the configured workspaces of
73 the current project while filtering by running only the workspaces de‐
74 fined by this configuration option.
75
76 Valid values for the workspace config are either:
77
78 • Workspace names
79
80 • Path to a workspace directory
81
82 • Path to a parent workspace directory (will result in selecting all
83 workspaces within that folder)
84
85
86 When set for the npm init command, this may be set to the folder of a
87 workspace which does not yet exist, to create the folder and set it up
88 as a brand new workspace within the project.
89
90 This value is not exported to the environment for child processes.
91 <!-- automatically generated, do not edit manually --> <!-- see
92 lib/utils/config/definitions.js -->
93
94
95 workspaces
96 • Default: null
97
98 • Type: null or Boolean
99
100
101 Set to true to run the command in the context of all configured
102 workspaces.
103
104 Explicitly setting this to false will cause commands like install to
105 ignore workspaces altogether. When not set explicitly:
106
107 • Commands that operate on the node_modules tree (install, update,
108 etc.) will link workspaces into the node_modules folder. - Commands
109 that do other things (test, exec, publish, etc.) will operate on the
110 root project, unless one or more workspaces are specified in the
111 workspace config.
112
113
114 This value is not exported to the environment for child processes.
115 <!-- automatically generated, do not edit manually --> <!-- see
116 lib/utils/config/definitions.js -->
117
118
119 include-workspace-root
120 • Default: false
121
122 • Type: Boolean
123
124
125 Include the workspace root when workspaces are enabled for a command.
126
127 When false, specifying individual workspaces via the workspace config,
128 or all workspaces via the workspaces flag, will cause npm to operate
129 only on the specified workspaces, and not on the root project. <!--
130 automatically generated, do not edit manually --> <!-- see
131 lib/utils/config/definitions.js -->
132
133 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
134
135
136 See Also
137 • npm help prune
138
139 • npm help install
140
141 • npm help folders
142
143 • npm help config
144
145 • npm help npmrc
146
147
148
149
150 January 2022 NPM-UNINSTALL(1)