How to deprecate an npm package version


This post covers how to deprecate or unpublish a version of an npm package.

Deprecate version

Deprecate a version of your package with npm deprecate:

npm deprecate <package>@<version> <message>

For example:

npm deprecate [email protected] "Yanked: no longer valid"

This marks the version as deprecated so npm will warn users when it’s installed without deleting it from the registry.

Unpublish version

If you want to take the nuclear option, you can remove the tarball from the registry with npm unpublish:

npm unpublish <package>@<version>

For example:

npm unpublish [email protected]

However, this may be blocked depending on npm’s deletion rules (e.g., if the version is too old or has dependents).



Please support this site and join our Discord!