codekingpro/portable-devtools
114k
1.TH "NPM-PACK" "1" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBnpm-pack\fR - Create a tarball from a package
4.SS "Synopsis"
5.P
6.RS 2
7.nf
8npm pack <package-spec>
9.fi
10.RE
11.SS "Configuration"
12.SS "\fBdry-run\fR"
13.RS 0
14.IP \(bu 4
15Default: false
16.IP \(bu 4
17Type: Boolean
18.RE 0
19
20.P
21Indicates 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.
22.P
23Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc.
24.SS "\fBjson\fR"
25.RS 0
26.IP \(bu 4
27Default: false
28.IP \(bu 4
29Type: Boolean
30.RE 0
31
32.P
33Whether or not to output JSON data, rather than the normal output.
34.RS 0
35.IP \(bu 4
36In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR.
37.RE 0
38
39.P
40Not supported by all npm commands.
41.SS "\fBpack-destination\fR"
42.RS 0
43.IP \(bu 4
44Default: "."
45.IP \(bu 4
46Type: String
47.RE 0
48
49.P
50Directory in which \fBnpm pack\fR will save tarballs.
51.SS "\fBworkspace\fR"
52.RS 0
53.IP \(bu 4
54Default:
55.IP \(bu 4
56Type: String (can be set multiple times)
57.RE 0
58
59.P
60Enable 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.
61.P
62Valid values for the \fBworkspace\fR config are either:
63.RS 0
64.IP \(bu 4
65Workspace names
66.IP \(bu 4
67Path to a workspace directory
68.IP \(bu 4
69Path to a parent workspace directory (will result in selecting all workspaces within that folder)
70.RE 0
71
72.P
73When 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.
74.P
75This value is not exported to the environment for child processes.
76.SS "\fBworkspaces\fR"
77.RS 0
78.IP \(bu 4
79Default: null
80.IP \(bu 4
81Type: null or Boolean
82.RE 0
83
84.P
85Set to true to run the command in the context of \fBall\fR configured workspaces.
86.P
87Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly:
88.RS 0
89.IP \(bu 4
90Commands 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.
91.RE 0
92
93.P
94This value is not exported to the environment for child processes.
95.SS "\fBinclude-workspace-root\fR"
96.RS 0
97.IP \(bu 4
98Default: false
99.IP \(bu 4
100Type: Boolean
101.RE 0
102
103.P
104Include the workspace root when workspaces are enabled for a command.
105.P
106When 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.
107.P
108This value is not exported to the environment for child processes.
109.SS "\fBignore-scripts\fR"
110.RS 0
111.IP \(bu 4
112Default: false
113.IP \(bu 4
114Type: Boolean
115.RE 0
116
117.P
118If true, npm does not run scripts specified in package.json files.
119.P
120Note 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.
121.SS "Description"
122.P
123For anything that's installable (that is, a package folder, tarball, tarball url, git url, name@tag, name@version, name, or scoped name), this command will fetch it to the cache, copy the tarball to the current working directory as \fB<name>-<version>.tgz\fR, and then write the filenames out to stdout.
124.P
125If the same package is specified multiple times, then the file will be overwritten the second time.
126.P
127If no arguments are supplied, then npm packs the current package folder.
128.SS "See Also"
129.RS 0
130.IP \(bu 4
131npm help "package spec"
132.IP \(bu 4
133\fBnpm-packlist package\fR \fI\(lahttp://npm.im/npm-packlist\(ra\fR
134.IP \(bu 4
135npm help cache
136.IP \(bu 4
137npm help publish
138.IP \(bu 4
139npm help config
140.IP \(bu 4
141npm help npmrc
142.RE 0
143 