1 ---
2 title: npm-pack
3 section: 1
4 description: Create a tarball from a package
5 github_repo: npm/cli
6 github_branch: release/v7
7 github_path: docs/content/commands/npm-pack.md
8 redirect_from:
9 - /cli-documentation/v7/cli-commands/npm-pack
10 - /cli-documentation/v7/cli-commands/pack
11 - /cli-documentation/v7/commands/npm-pack
12 - /cli-documentation/v7/commands/pack
13 - /cli-documentation/v7/npm-pack
14 - /cli-documentation/v7/pack
15 - /cli/v7/cli-commands/npm-pack
16 - /cli/v7/cli-commands/pack
17 - /cli/v7/commands/pack
18 - /cli/v7/npm-pack
19 - /cli/v7/pack
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm pack [[<@scope>/]<pkg>...] [--dry-run] [--json]
26 ```
27
28 ### Configuration
29
30 #### `dry-run`
31
32 - Default: false
33 - Type: Boolean
34
35 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`.
36
37 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
38
39 #### `json`
40
41 - Default: false
42 - Type: Boolean
43
44 Whether or not to output JSON data, rather than the normal output.
45
46 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
47
48 Not supported by all npm commands.
49
50 #### `pack-destination`
51
52 - Default: "."
53 - Type: String
54
55 Directory in which `npm pack` will save tarballs.
56
57 #### `workspace`
58
59 - Default:
60 - Type: String (can be set multiple times)
61
62 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.
63
64 Valid values for the `workspace` config are either:
65
66 - Workspace names
67 - Path to a workspace directory
68 - Path to a parent workspace directory (will result to selecting all of the nested workspaces)
69
70 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.
71
72 This value is not exported to the environment for child processes.
73
74 #### `workspaces`
75
76 - Default: false
77 - Type: Boolean
78
79 Enable running a command in the context of **all** the configured workspaces.
80
81 This value is not exported to the environment for child processes.
82
83 ### Description
84
85 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.
86
87 If the same package is specified multiple times, then the file will be overwritten the second time.
88
89 If no arguments are supplied, then npm packs the current package folder.
90
91 ### See Also
92
93 - [npm-packlist package](http://npm.im/npm-packlist)
94 - [npm cache](/cli/v7/commands/npm-cache)
95 - [npm publish](/cli/v7/commands/npm-publish)
96 - [npm config](/cli/v7/commands/npm-config)
97 - [npmrc](/cli/v7/configuring-npm/npmrc)