How to uninstall all npm Packages in Project
In this tutorial, we are going to learn about how to uninstall all the npm packages in a project, locally or globally.
Uninstalling a single package
To uninstall a single package, we can use the npm uninstall
command followed by the package name.
Example:
npm uninstall body-parser
Similarly, we can uninstall the global installed package by adding a -g
flag.
Example:
npm -g uninstall nodemon
Uninstalling Multiple packages
To uninstall the multiple packages, we can use the npm uninstall
command followed by multiple package names separated by the spaces package1
package2
.
Example:
npm uninstall express cors
for global :
npm -g uninstall express cors