LinuxCommandLibrary

npm-deprecate

marks a package version as deprecated on the npm registry

TLDR

Deprecate package version

$ npm deprecate [package]@[version] "[message]"
copy
Deprecate version range
$ npm deprecate [package]@"<[1.0.0]" "[message]"
copy
Deprecate all versions
$ npm deprecate [package] "[message]"
copy
Remove deprecation
$ npm deprecate [package]@[version] ""
copy

SYNOPSIS

npm deprecate pkg@version message

DESCRIPTION

npm deprecate marks a package version as deprecated on the npm registry. Users installing deprecated versions will see a warning message.
This is commonly used to discourage use of old or vulnerable versions while still allowing installation.

PARAMETERS

pkg@version

Package and version(s) to deprecate.
message
Deprecation message (empty to remove).

Deprecate specific version

npm deprecate my-package@1.0.0 "Critical bug, please upgrade"

Deprecate old versions

npm deprecate my-package@"<2.0.0" "Version 1.x is no longer supported"

Remove deprecation

npm deprecate my-package@1.0.0 ""

$
# USE CASES
copy
- Security vulnerabilities
- Breaking changes
- Package renamed
- End of support
$
# CAVEATS

Requires publish access to package. Doesn't prevent installation. Empty message removes deprecation.

# HISTORY

npm deprecate was added to provide a softer alternative to unpublishing, allowing maintainers to warn users without breaking existing installations.

# SEE ALSO

npm(1), npm-publish(1), npm-unpublish(1)
copy

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard