11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: npm-deprecate 31cb0ef41Sopenharmony_cisection: 1 41cb0ef41Sopenharmony_cidescription: Deprecate a version of a package 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci```bash 101cb0ef41Sopenharmony_cinpm deprecate <package-spec> <message> 111cb0ef41Sopenharmony_ci``` 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces. 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci### Description 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciThis command will update the npm registry entry for a package, providing a 181cb0ef41Sopenharmony_cideprecation warning to all who attempt to install it. 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciIt works on [version ranges](https://semver.npmjs.com/) as well as specific 211cb0ef41Sopenharmony_civersions, so you can do something like this: 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci```bash 241cb0ef41Sopenharmony_cinpm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3" 251cb0ef41Sopenharmony_ci``` 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciSemVer ranges passed to this command are interpreted such that they *do* 281cb0ef41Sopenharmony_ciinclude prerelease versions. For example: 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci```bash 311cb0ef41Sopenharmony_cinpm deprecate my-thing@1.x "1.x is no longer supported" 321cb0ef41Sopenharmony_ci``` 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ciIn this case, a version `my-thing@1.0.0-beta.0` will also be deprecated. 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ciYou must be the package owner to deprecate something. See the `owner` and 371cb0ef41Sopenharmony_ci`adduser` help topics. 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ciTo un-deprecate a package, specify an empty string (`""`) for the `message` 401cb0ef41Sopenharmony_ciargument. Note that you must use double quotes with no space between them to 411cb0ef41Sopenharmony_ciformat an empty string. 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci### Configuration 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci#### `registry` 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ci* Default: "https://registry.npmjs.org/" 481cb0ef41Sopenharmony_ci* Type: URL 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ciThe base URL of the npm registry. 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci#### `otp` 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci* Default: null 571cb0ef41Sopenharmony_ci* Type: null or String 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ciThis is a one-time password from a two-factor authenticator. It's needed 601cb0ef41Sopenharmony_ciwhen publishing or changing package permissions with `npm access`. 611cb0ef41Sopenharmony_ci 621cb0ef41Sopenharmony_ciIf not set, and a registry response fails with a challenge for a one-time 631cb0ef41Sopenharmony_cipassword, npm will prompt on the command line for one. 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ci### See Also 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ci* [package spec](/using-npm/package-spec) 701cb0ef41Sopenharmony_ci* [npm publish](/commands/npm-publish) 711cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry) 721cb0ef41Sopenharmony_ci* [npm owner](/commands/npm-owner) 731cb0ef41Sopenharmony_ci* [npm adduser](/commands/npm-adduser) 74