IT:AD:npm:HowTo:Uninstall A Package
- See also:
Summary
Uninstalling a package is about as easy installing.
Process
Delete All Local Packages
If you want to uninstall all packages, use IT:AD:Powershell, place yourself in the local root directory and do the following:
- uninstall all packages
npm uninstall (Get-ChildItem .\node_modules).Name
Note that
npm uninstall can handle paths that are longer than 260 – whereas the standard CLI cannot:
* IT:AD:npm:HowTo:Deal With Long FilenamesSave the Changes to the package.json File
npm uninstall just removes the package, but leaves the reference to the package in the package.json file.
If you want all mention of the package removed, use the -S or -D flags:
# remove from the dependencies section of package.json: npm uninstall foobar -S # or from the devDependencies section of package.json: npm uninstall foobar -D
It's wise to also clear the cache:
npm cache clear