Skip to content

How to change the version of an npm package associated with a specific tag

Erica Pisani
Erica Pisani
1 min read
How to change the version of an npm package associated with a specific tag
Photo by Brett Jordan / Unsplash

If publishing experimental npm packages is a somewhat regular part of your development workflow, you've likely experienced some nerves around publishing that package incorrectly such that it becomes the version that anyone newly installing or upgrading the package gets.

If you find that you accidentally did exactly this because you forgot to add the --tag flag with a different value than latest when running the npm publish command, don't worry - there's a safe way to fix this!

Run this: npm dist-tag add <package>@<version> latest

What this does is it adds the latest tag to the specified version of the package.

I had to do this recently myself and it's really that straightforward. And the best part is you don't need to go through the unpublishing process which has a bunch of scary warnings that make it sound like you're going to accidentally unpublish your whole project.

tips-and-tricksnodejstestingweb development

Comments


Related Posts

Members Public

How to install nvim-ufo in LazyVim to enable foldable code blocks

A feature that I've found myself missing since making the switch to Vim as my editor of choice is the ability to easily fold and expand code blocks. I know this functionality is included in Neovim, but I couldn't understand the native implementation enough to use

How to install nvim-ufo in LazyVim to enable foldable code blocks
Members Public

Git Log's Hidden Gems: Using -S and -L for Powerful Code History Search

Ever needed to track down when a specific piece of code was first introduced in a project? As part of some refactoring I had to do recently, I needed to do just that for a variable on a Django model. I was already familiar with the basic git log command,

Git Log's Hidden Gems: Using -S and -L for Powerful Code History Search
Members Public

Using XOR to write concise conditionals

It's not uncommon that I sometimes write if statements where the overall conditional is true when both conditions are true or both are false. As an example, let's say I'm validating input from an API call where I'm updating information on a