1NPM-PACK(1) NPM-PACK(1)
2
3
4
6 npm-pack - Create a tarball from a package
7
8 Synopsis
9 npm pack <package-spec>
10
11 Configuration
12 dry-run
13 • Default: false
14
15 • Type: Boolean
16
17
18 Indicates that you don't want npm to make any changes and that it
19 should only report what it would have done. This can be passed into any
20 of the commands that modify your local installation, eg, install, up‐
21 date, dedupe, uninstall, as well as pack and publish.
22
23 Note: This is NOT honored by other network related commands, eg dist-
24 tags, owner, etc.
25
26 json
27 • Default: false
28
29 • Type: Boolean
30
31
32 Whether or not to output JSON data, rather than the normal output.
33
34 • In npm pkg set it enables parsing set values with JSON.parse() be‐
35 fore saving them to your package.json.
36
37
38 Not supported by all npm commands.
39
40 pack-destination
41 • Default: "."
42
43 • Type: String
44
45
46 Directory in which npm pack will save tarballs.
47
48 workspace
49 • Default:
50
51 • Type: String (can be set multiple times)
52
53
54 Enable running a command in the context of the configured workspaces of
55 the current project while filtering by running only the workspaces de‐
56 fined by this configuration option.
57
58 Valid values for the workspace config are either:
59
60 • Workspace names
61
62 • Path to a workspace directory
63
64 • Path to a parent workspace directory (will result in selecting all
65 workspaces within that folder)
66
67
68 When set for the npm init command, this may be set to the folder of a
69 workspace which does not yet exist, to create the folder and set it up
70 as a brand new workspace within the project.
71
72 This value is not exported to the environment for child processes.
73
74 workspaces
75 • Default: null
76
77 • Type: null or Boolean
78
79
80 Set to true to run the command in the context of all configured
81 workspaces.
82
83 Explicitly setting this to false will cause commands like install to
84 ignore workspaces altogether. When not set explicitly:
85
86 • Commands that operate on the node_modules tree (install, update,
87 etc.) will link workspaces into the node_modules folder. - Commands
88 that do other things (test, exec, publish, etc.) will operate on
89 the root project, unless one or more workspaces are specified in
90 the workspace config.
91
92
93 This value is not exported to the environment for child processes.
94
95 include-workspace-root
96 • Default: false
97
98 • Type: Boolean
99
100
101 Include the workspace root when workspaces are enabled for a command.
102
103 When false, specifying individual workspaces via the workspace config,
104 or all workspaces via the workspaces flag, will cause npm to operate
105 only on the specified workspaces, and not on the root project.
106
107 This value is not exported to the environment for child processes.
108
109 Description
110 For anything that's installable (that is, a package folder, tarball,
111 tarball url, git url, name@tag, name@version, name, or scoped name),
112 this command will fetch it to the cache, copy the tarball to the cur‐
113 rent working directory as <name>-<version>.tgz, and then write the
114 filenames out to stdout.
115
116 If the same package is specified multiple times, then the file will be
117 overwritten the second time.
118
119 If no arguments are supplied, then npm packs the current package
120 folder.
121
122 See Also
123 • npm help "package spec"
124
125 • npm-packlist package ⟨http://npm.im/npm-packlist⟩
126
127 • npm help cache
128
129 • npm help publish
130
131 • npm help config
132
133 • npm help npmrc
134
135
136
137 November 2023 NPM-PACK(1)