Deprecate, unpublish, or recover an npm package

VSTS | TFS 2018 | TFS 2017

There are two options available to remove a version of an npm package from a feed.

  1. Deprecate: deprecating a version of a package adds a deprecation message that most npm clients, and VSTS, will show whenever the package is viewed or installed. Deprecating a version can help you discourage new usage of it by presenting a warning message when the package is installed.
  2. Unpublish: Unpublishing a version of a package makes it unavailable for install. After unpublishing, a package can be restored from the Recycle Bin within 30 days of deletion. After 30 days, it is permanently unavailable to restore. Unpublishing a package will cause others that depend on it to break.

Deprecate or unpublish an npm package VSTS

You must be a contributor to deprecate and an owner to unpublish.

Choose the package from the Packages hub in the Build and Release hub group and select the appropriate option from the menu:

Unpublish npm package Visual Studio Team Services

Deprecate or unpublish an npm package using npm

  1. Set up the npm client with your feed.
  2. Deprecate a package by running npm deprecate <package>[@<version>] <message>.
  3. Unpublish a package by running npm unpublish <package>@<version>.

At this time, it's not possible to use npm unpublish <package> to unpublish all versions.

See the deprecate or unpublish CLI docs for more info.

Recover an unpublished npm package

If you've deleted/unpublished an npm package, NuGet package, or Maven artifact from Visual Studio Team Services (VSTS), builds that depend on that package will start to fail. You won't be able to repush that package to the feed because of immutability. In order to recover the package and have builds start working again, you can recover it from the Recycle Bin.

  1. Find the Recycle Bin in the Packages page underneath the Build and Release hub in VSTS:

    Visual Studio Team Services Recycle Bin

    Once in the Recycle Bin, you will see any packages that have been deleted from the current feed in the past 30 days.

  2. Click a package to get more details such as: Version, Deleted date/time, and Scheduled permanent deletion:

    Visual Studio Team Services Recycle Bin package view

  3. Select a version to Restore to feed:

    Restore a VSTS package with Recycle Bin