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