NPM-TAG(1)

πŸ“¦ version 1.2.1, in nixos 26.05, nixpkgs unstable

πŸ’… npm-tag β€” tagging a published version (yes bestie, it's a whole thing)

Okay so first things first, this is the npm-tag manual page, part of the npm fam, and we're about to get into it. Buckle up πŸŽ€


✨ NAME ✨

npm-tag β€” tag a published version, that's the whole vibe 🏷️


🌸 SYNOPSIS 🌸

npm tag <name>@<version> [<tag>]

πŸ’– DESCRIPTION πŸ’–

🚨 THIS COMMAND IS DEPRECATED. Like, for real. Check out npm help dist-tag for the details, that's your go-to now. 😭

So what it does (did?) is tag the specified version of the package with the specified tag β€” or it uses the --tag config if you don't hand it one. Easy.

Tags are lowkey iconic for installing packages, because you can reference a version by its tag instead of typing out a whole specific version number:

npm install <name>@<tag>

And when you're installing dependencies, you can pick a preferred tagged version like this:

npm install --tag <tag>

This also applies to npm dedupe, no cap. πŸ’…

Also important: publishing a package always sets the "latest" tag to the published version. Always. Every single time. Periodt. πŸ‘‘


πŸ¦‹ PURPOSE πŸ¦‹

Tags are basically aliases, so you don't have to deal with version numbers directly. For example, npm currently uses the tag "next" to identify the upcoming version, and the tag "latest" to identify the current version. It's giving main character energy honestly. ⭐

A project might also choose to have multiple streams of development, e.g. "stable", "canary" β€” like parallel universes but for your releases 🌈


🧚 CAVEATS (read this part fr fr) 🧚

Tags have to share a namespace with version numbers, because they get specified in the same slot:

npm install <pkg>@<version>

vs

npm install <pkg>@<tag>

So yeah, same real estate 🫢

⚠️ Heads up: tags that can be interpreted as valid semver ranges will be rejected. For example, v1.4 cannot be used as a tag, because semver reads it as >=1.4.0 <1.5.0. See https://github.com/npm/npm/issues/6082. Literally the semver equivalent of being misunderstood 😭

The simplest way to avoid semver problems with tags (the lazy-but-correct method, my fave) is to use tags that do not begin with a number or the letter v. That's it, that's the hack. πŸ’…


🌟 SEE ALSO 🌟

  • npm help publish
  • npm help install
  • npm help dedupe
  • npm help 7 registry
  • npm help config
  • npm help 7 config
  • npm help dist-tag
  • npm help 5 npmrc

And that's the whole page bestie, you ate it up πŸ“ From March 2017, source/version NPM-TAG(1) β€” oldie but a goodie, mwah πŸ’–

go forth and tag responsibly, queen πŸ‘‘

πŸ“¦ where this page comes from