1 ---
2section: cli-commands
3title: npm-dist-tag
4description: Modify package distribution tags
5---
6
7# npm-dist-tag(1)
8
9## Modify package distribution tags
10
11
12### Synopsis
13```bash
14npm dist-tag add <pkg>@<version> [<tag>]
15npm dist-tag rm <pkg> <tag>
16npm dist-tag ls [<pkg>]
17
18aliases: dist-tags
19```
20
21### Description
22
23Add, remove, and enumerate distribution tags on a package:
24
25* add:
26  Tags the specified version of the package with the specified tag, or the
27  `--tag` config if not specified. If you have two-factor authentication on
28  auth-and-writes then you’ll need to include a one-time password on the
29  command line with `--otp <one-time password>`.
30
31* rm:
32  Clear a tag that is no longer in use from the package.
33
34* ls:
35  Show all of the dist-tags for a package, defaulting to the package in
36  the current prefix. This is the default action if none is specified.
37
38A tag can be used when installing packages as a reference to a version instead
39of using a specific version number:
40
41```bash
42npm install <name>@<tag>
43```
44
45When installing dependencies, a preferred tagged version may be specified:
46
47```bash
48npm install --tag <tag>
49```
50
51This also applies to `npm dedupe`.
52
53Publishing a package sets the `latest` tag to the published version unless the
54`--tag` option is used. For example, `npm publish --tag=beta`.
55
56By default, `npm install <pkg>` (without any `@<version>` or `@<tag>`
57specifier) installs the `latest` tag.
58
59### Purpose
60
61Tags can be used to provide an alias instead of version numbers.
62
63For example, a project might choose to have multiple streams of development
64and use a different tag for each stream,
65e.g., `stable`, `beta`, `dev`, `canary`.
66
67By default, the `latest` tag is used by npm to identify the current version of
68a package, and `npm install <pkg>` (without any `@<version>` or `@<tag>`
69specifier) installs the `latest` tag. Typically, projects only use the `latest`
70tag for stable release versions, and use other tags for unstable versions such
71as prereleases.
72
73The `next` tag is used by some projects to identify the upcoming version.
74
75By default, other than `latest`, no tag has any special significance to npm
76itself.
77
78### Caveats
79
80This command used to be known as `npm tag`, which only created new tags, and so
81had a different syntax.
82
83Tags must share a namespace with version numbers, because they are specified in
84the same slot: `npm install <pkg>@<version>` vs `npm install <pkg>@<tag>`.
85
86Tags that can be interpreted as valid semver ranges will be rejected. For
87example, `v1.4` cannot be used as a tag, because it is interpreted by semver as
88`>=1.4.0 <1.5.0`.  See <https://github.com/npm/npm/issues/6082>.
89
90The simplest way to avoid semver problems with tags is to use tags that do not
91begin with a number or the letter `v`.
92
93### See Also
94
95* [npm publish](/cli-commands/npm-publish)
96* [npm install](/cli-commands/npm-install)
97* [npm dedupe](/cli-commands/npm-dedupe)
98* [npm registry](/using-npm/registry)
99* [npm config](/cli-commands/npm-config)
100* [npmrc](/configuring-npm/npmrc)
101