1 ---
2 title: npm-pack
3 section: 1
4 description: Create a tarball from a package
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-pack.md
8 redirect_from:
9 - /cli-commands/npm-pack
10 - /cli-commands/pack
11 - /cli-documentation/cli-commands/npm-pack
12 - /cli-documentation/cli-commands/pack
13 - /cli-documentation/commands/npm-pack
14 - /cli-documentation/commands/pack
15 - /cli-documentation/npm-pack
16 - /cli-documentation/pack
17 - /cli-documentation/v10/cli-commands/npm-pack
18 - /cli-documentation/v10/cli-commands/pack
19 - /cli-documentation/v10/commands/npm-pack
20 - /cli-documentation/v10/commands/pack
21 - /cli-documentation/v10/npm-pack
22 - /cli-documentation/v10/pack
23 - /cli/cli-commands/npm-pack
24 - /cli/cli-commands/pack
25 - /cli/commands/npm-pack
26 - /cli/commands/pack
27 - /cli/npm-pack
28 - /cli/pack
29 - /cli/v10/cli-commands/npm-pack
30 - /cli/v10/cli-commands/pack
31 - /cli/v10/commands/pack
32 - /cli/v10/npm-pack
33 - /cli/v10/pack
34 - /commands/npm-pack
35 - /commands/pack
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm pack <package-spec>
42 ```
43
44 ### Configuration
45
46 #### `dry-run`
47
48 - Default: false
49 - Type: Boolean
50
51 Indicates 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, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`.
52
53 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
54
55 #### `json`
56
57 - Default: false
58 - Type: Boolean
59
60 Whether or not to output JSON data, rather than the normal output.
61
62 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
63
64 Not supported by all npm commands.
65
66 #### `pack-destination`
67
68 - Default: "."
69 - Type: String
70
71 Directory in which `npm pack` will save tarballs.
72
73 #### `workspace`
74
75 - Default:
76 - Type: String (can be set multiple times)
77
78 Enable 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.
79
80 Valid values for the `workspace` config are either:
81
82 - Workspace names
83 - Path to a workspace directory
84 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
85
86 When set for the `npm init` 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.
87
88 This value is not exported to the environment for child processes.
89
90 #### `workspaces`
91
92 - Default: null
93 - Type: null or Boolean
94
95 Set to true to run the command in the context of **all** configured workspaces.
96
97 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
98
99 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
100
101 This value is not exported to the environment for child processes.
102
103 #### `include-workspace-root`
104
105 - Default: false
106 - Type: Boolean
107
108 Include the workspace root when workspaces are enabled for a command.
109
110 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
111
112 This value is not exported to the environment for child processes.
113
114 ### Description
115
116 For 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 `<name>-<version>.tgz`, and then write the filenames out to stdout.
117
118 If the same package is specified multiple times, then the file will be overwritten the second time.
119
120 If no arguments are supplied, then npm packs the current package folder.
121
122 ### See Also
123
124 - [package spec](/cli/v10/using-npm/package-spec)
125 - [npm-packlist package](http://npm.im/npm-packlist)
126 - [npm cache](/cli/v10/commands/npm-cache)
127 - [npm publish](/cli/v10/commands/npm-publish)
128 - [npm config](/cli/v10/commands/npm-config)
129 - [npmrc](/cli/v10/configuring-npm/npmrc)