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 in selecting all
107 workspaces within that folder)
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: null
121
122 • Type: null or Boolean
123
124
125 Set to true to run the command in the context of all configured
126 workspaces.
127
128 Explicitly setting this to false will cause commands like install to
129 ignore workspaces altogether. When not set explicitly:
130
131 • Commands that operate on the node_modules tree (install, update,
132 etc.) will link workspaces into the node_modules folder. - Commands
133 that do other things (test, exec, publish, etc.) will operate on the
134 root project, unless one or more workspaces are specified in the
135 workspace config.
136
137
138 This value is not exported to the environment for child processes.
139 <!-- automatically generated, do not edit manually --> <!-- see
140 lib/utils/config/definitions.js -->
141
142
143 include-workspace-root
144 • Default: false
145
146 • Type: Boolean
147
148
149 Include the workspace root when workspaces are enabled for a command.
150
151 When false, specifying individual workspaces via the workspace config,
152 or all workspaces via the workspaces flag, will cause npm to operate
153 only on the specified workspaces, and not on the root project. <!--
154 automatically generated, do not edit manually --> <!-- see
155 lib/utils/config/definitions.js -->
156
157 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
158
159
160 See Also
161 • npm help publish
162
163 • npm help install
164
165 • npm help dedupe
166
167 • npm help registry
168
169 • npm help config
170
171 • npm help npmrc
172
173
174
175
176 January 2022 NPM-DIST-TAG(1)