1 ---
2 title: npm-deprecate
3 section: 1
4 description: Deprecate a version of a package
5 github_repo: npm/cli
6 github_branch: release/v7
7 github_path: docs/content/commands/npm-deprecate.md
8 redirect_from:
9 - /cli-documentation/v7/cli-commands/deprecate
10 - /cli-documentation/v7/cli-commands/npm-deprecate
11 - /cli-documentation/v7/commands/deprecate
12 - /cli-documentation/v7/commands/npm-deprecate
13 - /cli-documentation/v7/deprecate
14 - /cli-documentation/v7/npm-deprecate
15 - /cli/v7/cli-commands/deprecate
16 - /cli/v7/cli-commands/npm-deprecate
17 - /cli/v7/commands/deprecate
18 - /cli/v7/deprecate
19 - /cli/v7/npm-deprecate
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm deprecate <pkg>[@<version range>] <message>
26 ```
27
28 Note: This command is unaware of workspaces.
29
30 ### Description
31
32 This command will update the npm registry entry for a package, providing a deprecation warning to all who attempt to install it.
33
34 It works on [version ranges](https://semver.npmjs.com/) as well as specific versions, so you can do something like this:
35
36 ```bash
37 npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3"
38 ```
39
40 SemVer ranges passed to this command are interpreted such that they _do_ include prerelease versions. For example:
41
42 ```bash
43 npm deprecate my-thing@1.x "1.x is no longer supported"
44 ```
45
46 In this case, a version `my-thing@1.0.0-beta.0` will also be deprecated.
47
48 You must be the package owner to deprecate something. See the `owner` and `adduser` help topics.
49
50 To un-deprecate a package, specify an empty string (`""`) for the `message` argument. Note that you must use double quotes with no space between them to format an empty string.
51
52 ### Configuration
53
54 #### `registry`
55
56 - Default: "https://registry.npmjs.org/"
57 - Type: URL
58
59 The base URL of the npm registry.
60
61 #### `otp`
62
63 - Default: null
64 - Type: null or String
65
66 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
67
68 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
69
70 ### See Also
71
72 - [npm publish](/cli/v7/commands/npm-publish)
73 - [npm registry](/cli/v7/using-npm/registry)
74 - [npm owner](/cli/v7/commands/npm-owner)
75 - [npm adduser](/cli/v7/commands/npm-adduser)