What This Error Means
npm rejected the dist-tag because the tag name is invalid, reserved, or formatted in a way that conflicts with version parsing.
How to Fix It
Re-run the command and inspect the exact tag value you passed to npm publish --tag or npm dist-tag add.
Use descriptive tag names like latest, next, beta, or canary instead of version-like strings.
If you meant to install or inspect a tag, list existing tags first:npm view <pkg> dist-tags --json
If you are updating tags, use the explicit form:npm dist-tag add <pkg>@<version> <tag>
Retry after replacing the invalid tag with a non-semver-looking value.
Why It Happens
The tag can be interpreted as a semver range, so npm rejects it as ambiguous.
The tag starts with a number or v, which often collides with version-style parsing.
The command used the wrong value in the tag position, or the package and tag arguments were swapped.
How to Verify
Run npm view <pkg> dist-tags --json and confirm the intended tag exists with the expected version.
Repeat the original npm dist-tag or npm publish --tag command and confirm EINVALIDTAGNAME is gone.
Manual dist-tag checks
Check the literal tag value before retrying. If it looks like v1.4 or 1.x, rename it.
List current tags with npm view <pkg> dist-tags --json so you can compare against a known-good tag.
If the error happened in CI, print the resolved tag variable before running npm.
Examples
Valid dist-tag: latest
Valid dist-tag: canary
Invalid dist-tag: v1.4 # looks like a semver range
npm dist-tag add @acme/widget@1.4.0 beta How npm validates dist-tags
Dist-tags share the same namespace slot as versions when you use npm install <pkg>@<specifier>.
npm rejects tag names that look like semver ranges because they would be ambiguous during resolution.
This is usually a local command or input problem, not a registry availability problem.
Prevention Tips
Avoid tags that look like versions or semver ranges.
Standardize on a small set of release tags such as latest, next, beta, and canary.
Document the exact npm dist-tag add <pkg>@<version> <tag> command used in release automation.