22

I've published a grunt plugin to npm that's been tracking the grunt 0.4 RCs by using the master tag. I've been publishing with:

npm publish --tag master

Now that grunt 0.4 final has been released, I've re-published my plugin as latest via:

npm publish

How can I now remove the master tag from the npm repository? It is still listed in dist-tags when I npm view [my-plugin].

Thanks in advance.

Dan Gebhardt
  • 3,251
  • 1
  • 18
  • 15

3 Answers3

29

It was not possible to remove dist-tags from the npm registry prior to npm@2.5.0. There is now a command-line syntax for this, provided you update to a new version of npm -- see https://github.com/npm/npm/wiki/Troubleshooting#try-the-latest-stable-version-of-npm for full details on upgrading.

Install latest version of npm

npm install -g npm    # most common way to upgrade

Clear a tag that is no longer in use from the package.

npm dist-tag rm <pkg> <tag>
Sibiraj
  • 4,486
  • 7
  • 33
  • 57
Sam Mikes
  • 10,438
  • 3
  • 42
  • 47
5

Just to confirm, that (in private repo's in verdaccio), you CAN unpublish tags like this:

npm unpublish <name>[@<version>]

Which translates to (for instance):

npm unpublish @yourdomain/your_package@1.1.100

This will delete the relevant tag.

Katinka Hesselink
  • 3,961
  • 4
  • 20
  • 26
3

master may be in your npm config.

check what this gives:

npm config get tag

To get back to use latest, this should do:

npm config set tag latest

An other possibility is to un-publish the version with the master tag using:

npm unpublish <name>[@<version>]

this is likely to remove the tag in dist-tags (but since I haven't tried, not certain).

Pascal Belloncle
  • 11,184
  • 3
  • 56
  • 56
  • Thanks for your reply. `npm config get tag` returns `latest` now because it is the last tag I used to publish my plugin. I am still seeing the `master` tag in `dist-tags` when I `npm view [my-plugin]`. – Dan Gebhardt Feb 22 '13 at 21:25
  • but is the master tag pointing to latest version? Or to the new version? Or did you not change the version in package.json? – Pascal Belloncle Feb 22 '13 at 21:45
  • You could also try to use `npm unpublish [@]`, if you'd like to still have this version on npmjs, you could try to publish again with the right tag. – Pascal Belloncle Feb 22 '13 at 21:50
  • The latest tag is pointing to the right version. I just want to remove the master tag without unpublishing the version currently associated with it. Ideally, only the latest tag should now be associated with the plugin and listed in npm. Perhaps this is not possible? – Dan Gebhardt Feb 22 '13 at 22:08
  • 1
    what about unpublish old version, then publish again using `latest` instead of `master` (if you can find the right revision from git)? There does not appear to have an option to remove a tag otherwise. – Pascal Belloncle Feb 22 '13 at 22:13
  • Thanks for your assistance. I suppose there is no way to remove a tag without unpublishing, so I may just leave the old tag around for now. – Dan Gebhardt Feb 22 '13 at 23:04