2019-11-05 14:55:08 -05:00
|
|
|
---
|
|
|
|
title: npm-deprecate
|
2020-11-01 07:54:36 +01:00
|
|
|
section: 1
|
2019-11-05 14:55:08 -05:00
|
|
|
description: Deprecate a version of a package
|
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Synopsis
|
2020-11-01 07:54:36 +01:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
2022-06-24 18:21:50 -07:00
|
|
|
npm deprecate <package-spec> <message>
|
2019-11-05 14:55:08 -05:00
|
|
|
```
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-03-23 14:58:11 -04:00
|
|
|
Note: This command is unaware of workspaces.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2020-11-01 07:54:36 +01:00
|
|
|
This command will update the npm registry entry for a package, providing a
|
|
|
|
deprecation warning to all who attempt to install it.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2020-11-01 07:54:36 +01:00
|
|
|
It works on [version ranges](https://semver.npmjs.com/) as well as specific
|
2018-11-29 14:05:52 -08:00
|
|
|
versions, so you can do something like this:
|
2020-11-01 07:54:36 +01:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
|
|
|
npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3"
|
|
|
|
```
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2020-12-18 15:39:05 -05:00
|
|
|
SemVer ranges passed to this command are interpreted such that they *do*
|
|
|
|
include prerelease versions. For example:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm deprecate my-thing@1.x "1.x is no longer supported"
|
|
|
|
```
|
|
|
|
|
|
|
|
In this case, a version `my-thing@1.0.0-beta.0` will also be deprecated.
|
|
|
|
|
|
|
|
You must be the package owner to deprecate something. See the `owner` and
|
|
|
|
`adduser` help topics.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2022-06-24 18:21:50 -07:00
|
|
|
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
|
2018-11-29 14:05:52 -08:00
|
|
|
format an empty string.
|
2012-12-21 16:42:29 +00:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
### Configuration
|
|
|
|
|
|
|
|
#### `registry`
|
|
|
|
|
|
|
|
* Default: "https://registry.npmjs.org/"
|
|
|
|
* Type: URL
|
|
|
|
|
|
|
|
The base URL of the npm registry.
|
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `otp`
|
|
|
|
|
|
|
|
* Default: null
|
|
|
|
* Type: null or String
|
|
|
|
|
|
|
|
This is a one-time password from a two-factor authenticator. It's needed
|
|
|
|
when publishing or changing package permissions with `npm access`.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2025-02-02 07:09:59 -08:00
|
|
|
#### `dry-run`
|
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
Indicates that you don't want npm to make any changes and that it should
|
|
|
|
only report what it would have done. This can be passed into any of the
|
|
|
|
commands that modify your local installation, eg, `install`, `update`,
|
|
|
|
`dedupe`, `uninstall`, as well as `pack` and `publish`.
|
|
|
|
|
|
|
|
Note: This is NOT honored by other network related commands, eg `dist-tags`,
|
|
|
|
`owner`, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### See Also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2022-06-24 18:21:50 -07:00
|
|
|
* [package spec](/using-npm/package-spec)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm publish](/commands/npm-publish)
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npm registry](/using-npm/registry)
|
2021-05-10 17:31:02 -04:00
|
|
|
* [npm owner](/commands/npm-owner)
|
2021-09-09 20:01:11 +00:00
|
|
|
* [npm adduser](/commands/npm-adduser)
|