Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
npm-prune.1185 linesDownload Raw Back to man1
1.TH "NPM-PRUNE" "1" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBnpm-prune\fR - Remove extraneous packages
4.SS "Synopsis"
5.P
6.RS 2
7.nf
8npm prune \[lB]\[lB]<@scope>/\[rB]<pkg>...\[rB]
9.fi
10.RE
11.SS "Description"
12.P
13This command removes "extraneous" packages. If a package name is provided, then only packages matching one of the supplied names are removed.
14.P
15Extraneous packages are those present in the \fBnode_modules\fR folder that are not listed as any package's dependency list.
16.P
17If the \fB--omit=dev\fR flag is specified or the \fBNODE_ENV\fR environment variable is set to \fBproduction\fR, this command will remove the packages specified in your \fBdevDependencies\fR.
18.P
19If the \fB--dry-run\fR flag is used then no changes will actually be made.
20.P
21If the \fB--json\fR flag is used, then the changes \fBnpm prune\fR made (or would have made with \fB--dry-run\fR) are printed as a JSON object.
22.P
23In normal operation, extraneous modules are pruned automatically, so you'll only need this command with the \fB--production\fR flag. However, in the real world, operation is not always "normal". When crashes or mistakes happen, this command can help clean up any resulting garbage.
24.SS "Configuration"
25.SS "\fBomit\fR"
26.RS 0
27.IP \(bu 4
28Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production'; otherwise, empty.
29.IP \(bu 4
30Type: "dev", "optional", or "peer" (can be set multiple times)
31.RE 0
32
33.P
34Dependency types to omit from the installation tree on disk.
35.P
36Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk.
37.P
38If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included.
39.P
40If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts.
41.SS "\fBinclude\fR"
42.RS 0
43.IP \(bu 4
44Default:
45.IP \(bu 4
46Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
47.RE 0
48
49.P
50Option that allows for defining which types of dependencies to install.
51.P
52This is the inverse of \fB--omit=<type>\fR.
53.P
54Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line.
55.SS "\fBdry-run\fR"
56.RS 0
57.IP \(bu 4
58Default: false
59.IP \(bu 4
60Type: Boolean
61.RE 0
62
63.P
64Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR.
65.P
66Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc.
67.SS "\fBjson\fR"
68.RS 0
69.IP \(bu 4
70Default: false
71.IP \(bu 4
72Type: Boolean
73.RE 0
74
75.P
76Whether or not to output JSON data, rather than the normal output.
77.RS 0
78.IP \(bu 4
79In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR.
80.RE 0
81
82.P
83Not supported by all npm commands.
84.SS "\fBforeground-scripts\fR"
85.RS 0
86.IP \(bu 4
87Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR
88.IP \(bu 4
89Type: Boolean
90.RE 0
91
92.P
93Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process.
94.P
95Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging.
96.SS "\fBignore-scripts\fR"
97.RS 0
98.IP \(bu 4
99Default: false
100.IP \(bu 4
101Type: Boolean
102.RE 0
103
104.P
105If true, npm does not run scripts specified in package.json files.
106.P
107Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts.
108.SS "\fBworkspace\fR"
109.RS 0
110.IP \(bu 4
111Default:
112.IP \(bu 4
113Type: String (can be set multiple times)
114.RE 0
115
116.P
117Enable 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.
118.P
119Valid values for the \fBworkspace\fR config are either:
120.RS 0
121.IP \(bu 4
122Workspace names
123.IP \(bu 4
124Path to a workspace directory
125.IP \(bu 4
126Path to a parent workspace directory (will result in selecting all workspaces within that folder)
127.RE 0
128
129.P
130When 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.
131.P
132This value is not exported to the environment for child processes.
133.SS "\fBworkspaces\fR"
134.RS 0
135.IP \(bu 4
136Default: null
137.IP \(bu 4
138Type: null or Boolean
139.RE 0
140
141.P
142Set to true to run the command in the context of \fBall\fR configured workspaces.
143.P
144Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly:
145.RS 0
146.IP \(bu 4
147Commands 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.
148.RE 0
149
150.P
151This value is not exported to the environment for child processes.
152.SS "\fBinclude-workspace-root\fR"
153.RS 0
154.IP \(bu 4
155Default: false
156.IP \(bu 4
157Type: Boolean
158.RE 0
159
160.P
161Include the workspace root when workspaces are enabled for a command.
162.P
163When 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.
164.P
165This value is not exported to the environment for child processes.
166.SS "\fBinstall-links\fR"
167.RS 0
168.IP \(bu 4
169Default: false
170.IP \(bu 4
171Type: Boolean
172.RE 0
173
174.P
175When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
176.SS "See Also"
177.RS 0
178.IP \(bu 4
179npm help uninstall
180.IP \(bu 4
181npm help folders
182.IP \(bu 4
183npm help ls
184.RE 0
185 
codekingpro/portable-devtools · Team Ai