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