it:ad:npm:howto:uninstall_a_package

IT:AD:npm:HowTo:Uninstall A Package

Summary

Uninstalling a package is about as easy installing.

uninstall locally
 npm uninstall http-server

or

uninstall globally
 npm uninstall http-server -g

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 Filenames

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

  • /home/skysigal/public_html/data/pages/it/ad/npm/howto/uninstall_a_package.txt
  • Last modified: 2023/11/04 23:00
  • by 127.0.0.1