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