1NPM-UNINSTALL(1) NPM-UNINSTALL(1)
2
3
4
6 npm-uninstall - Remove a package
7
8 Synopsis
9 npm uninstall [<@scope>/]<pkg>...
10
11 aliases: unlink, remove, rm, r, un
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 Further, 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 save
50 • Default: true unless when using npm update where it defaults to false
51
52 • Type: Boolean
53
54
55 Save installed packages to a package.json file as dependencies.
56
57 When used with the npm rm command, removes the dependency from pack‐
58 age.json.
59
60 Will also prevent writing to package-lock.json if set to false.
61
62 workspace
63 • Default:
64
65 • Type: String (can be set multiple times)
66
67
68 Enable running a command in the context of the configured workspaces of
69 the current project while filtering by running only the workspaces de‐
70 fined by this configuration option.
71
72 Valid values for the workspace config are either:
73
74 • Workspace names
75
76 • Path to a workspace directory
77
78 • Path to a parent workspace directory (will result in selecting all
79 workspaces within that folder)
80
81
82 When set for the npm init command, this may be set to the folder of a
83 workspace which does not yet exist, to create the folder and set it up
84 as a brand new workspace within the project.
85
86 This value is not exported to the environment for child processes.
87
88 workspaces
89 • Default: null
90
91 • Type: null or Boolean
92
93
94 Set to true to run the command in the context of all configured
95 workspaces.
96
97 Explicitly setting this to false will cause commands like install to
98 ignore workspaces altogether. When not set explicitly:
99
100 • Commands that operate on the node_modules tree (install, update,
101 etc.) will link workspaces into the node_modules folder. - Commands
102 that do other things (test, exec, publish, etc.) will operate on the
103 root project, unless one or more workspaces are specified in the
104 workspace config.
105
106
107 This value is not exported to the environment for child processes.
108
109 include-workspace-root
110 • Default: false
111
112 • Type: Boolean
113
114
115 Include the workspace root when workspaces are enabled for a command.
116
117 When false, specifying individual workspaces via the workspace config,
118 or all workspaces via the workspaces flag, will cause npm to operate
119 only on the specified workspaces, and not on the root project.
120
121 This value is not exported to the environment for child processes.
122
123 install-links
124 • Default: false
125
126 • Type: Boolean
127
128
129 When set file: protocol dependencies that exist outside of the project
130 root will be packed and installed as regular dependencies instead of
131 creating a symlink. This option has no effect on workspaces.
132
133 See Also
134 • npm help prune
135
136 • npm help install
137
138 • npm help folders
139
140 • npm help config
141
142 • npm help npmrc
143
144
145
146
147 September 2022 NPM-UNINSTALL(1)