1NPM-DIST-TAG(1) NPM-DIST-TAG(1)
2
3
4
6 npm-dist-tag - Modify package distribution tags
7
8 Synopsis
9 npm dist-tag add <pkg>@<version> [<tag>]
10 npm dist-tag rm <pkg> <tag>
11 npm dist-tag ls [<pkg>]
12
13 aliases: dist-tags
14
15 Description
16 Add, remove, and enumerate distribution tags on a package:
17
18 • add: Tags the specified version of the package with the specified
19 tag, or the --tag config if not specified. If you have two-factor au‐
20 thentication on auth-and-writes then you’ll need to include a
21 one-time password on the command line with --otp <one-time password>,
22 or at the OTP prompt.
23
24 • rm: Clear a tag that is no longer in use from the package. If you
25 have two-factor authentication on auth-and-writes then you’ll need to
26 include a one-time password on the command line with --otp <one-time
27 password>, or at the OTP prompt.
28
29 • ls: Show all of the dist-tags for a package, defaulting to the pack‐
30 age in the current prefix. This is the default action if none is
31 specified.
32
33
34 A tag can be used when installing packages as a reference to a version
35 instead of using a specific version number:
36
37 npm install <name>@<tag>
38
39 When installing dependencies, a preferred tagged version may be speci‐
40 fied:
41
42 npm install --tag <tag>
43
44 (This also applies to any other commands that resolve and install de‐
45 pendencies, such as npm dedupe, npm update, and npm audit fix.)
46
47 Publishing a package sets the latest tag to the published version un‐
48 less the --tag option is used. For example, npm publish --tag=beta.
49
50 By default, npm install <pkg> (without any @<version> or @<tag> speci‐
51 fier) installs the latest tag.
52
53 Purpose
54 Tags can be used to provide an alias instead of version numbers.
55
56 For example, a project might choose to have multiple streams of devel‐
57 opment and use a different tag for each stream, e.g., stable, beta,
58 dev, canary.
59
60 By default, the latest tag is used by npm to identify the current ver‐
61 sion of a package, and npm install <pkg> (without any @<version> or
62 @<tag> specifier) installs the latest tag. Typically, projects only use
63 the latest tag for stable release versions, and use other tags for un‐
64 stable versions such as prereleases.
65
66 The next tag is used by some projects to identify the upcoming version.
67
68 Other than latest, no tag has any special significance to npm itself.
69
70 Caveats
71 This command used to be known as npm tag, which only created new tags,
72 and so had a different syntax.
73
74 Tags must share a namespace with version numbers, because they are
75 specified in the same slot: npm install <pkg>@<version> vs npm install
76 <pkg>@<tag>.
77
78 Tags that can be interpreted as valid semver ranges will be rejected.
79 For example, v1.4 cannot be used as a tag, because it is interpreted by
80 semver as >=1.4.0 <1.5.0. See https://github.com/npm/npm/issues/6082.
81
82 The simplest way to avoid semver problems with tags is to use tags that
83 do not begin with a number or the letter v.
84
85 Configuration
86 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
87 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
88 tions.js -->
89
90 workspace
91 • Default:
92
93 • Type: String (can be set multiple times)
94
95
96 Enable running a command in the context of the configured workspaces of
97 the current project while filtering by running only the workspaces de‐
98 fined by this configuration option.
99
100 Valid values for the workspace config are either:
101
102 • Workspace names
103
104 • Path to a workspace directory
105
106 • Path to a parent workspace directory (will result to selecting all of
107 the nested workspaces)
108
109
110 When set for the npm init command, this may be set to the folder of a
111 workspace which does not yet exist, to create the folder and set it up
112 as a brand new workspace within the project.
113
114 This value is not exported to the environment for child processes.
115 <!-- automatically generated, do not edit manually --> <!-- see
116 lib/utils/config/definitions.js -->
117
118
119 workspaces
120 • Default: false
121
122 • Type: Boolean
123
124
125 Enable running a command in the context of all the configured
126 workspaces.
127
128 This value is not exported to the environment for child processes.
129 <!-- automatically generated, do not edit manually --> <!-- see
130 lib/utils/config/definitions.js -->
131
132 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
133
134
135 See Also
136 • npm help publish
137
138 • npm help install
139
140 • npm help dedupe
141
142 • npm help registry
143
144 • npm help config
145
146 • npm help npmrc
147
148
149
150
151 October 2021 NPM-DIST-TAG(1)