Npm-uninstall and npm-unpublish cli commands
The last tutorial was a guide to creating and managing your npm tokens, the tutorial you are about to read will show you how you can remove a package as well as how to get your package unpublished.
This npm uninstall command will remove a package.
npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save] aliases: remove, rm, r, un, unlink
This command will uninstall a package, doing this will completely remove everything npm installed because of that package.
Npm uninstall angular-cli, will remove the angular cli as well as all the dependencies that were installed for it to work on your environment.
When you run this command in global mode, it will uninstall the current package context as a global package.
There are four optional flags that you can pass to the command, they are:
-S, --save: The package will be removed from your dependencies.
-D, --save-dev: The package will be removed from your devDependencies.
-O, --save-optional: The package will be removed from your optionalDependencies.
--no-save: The package will not be removed from your package.json file.
Additionally, if you have an npm-shrinkwrap.json file, it will also be updated.
Here is an example:
npm uninstall sax --save npm uninstall @myorg/privatepackage --save npm uninstall node-tap --save-dev npm uninstall dtrace-provider --save-optional npm uninstall lodash --no-save
The npm unpublish command removes a package from the registry.
npm unpublish [<@scope>/]<pkg>[@<version>]
Generally, it is considered a bad behavior to remove versions of a library that others are depending on!
You should consider using the deprecate command instead, if what you intend is to encourage users to upgrade.
The npm unpublish command removes a package version from the registry, thus deleting its entry and removing the tarball.
If you do not specify a version, or if all the versions are removed then the root package entry is removed from the registry entirely.
Even when a package version is unpublished, that specific name and version combination can never be reused in the npm registry. For you to publish the package again, a new version number has to be used.
Using the default registry (registry.npmjs.org), the unpublish command is only allowed with versions published in the last 72 hours. Similarly, new versions of unpublished packages cannot be republished until 72 hours have passed. In the case where you are trying to unpublish a version published longer ago than that, you should contact [email protected]
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework