how to uninstall via npm code example

Example 1: How to uninstall npm modules in node js?

The command is simply npm uninstall 
// Here are different options:
// - removes the module from node_modules but 
//   does NOT update package.json
npm uninstall 

// - removes it from dependencies in package.json aswell
npm uninstall  --save

// - removes it from devDependencies in package.json aswell
npm uninstall  --save-dev

// -  also removes it globally 
npm uninstall -g  --save 

//    If you're removing a global package, however, any applications 
//    referencing it will crash.

// A local install will be in the node_modules/ directory of your 
//  application. This won't affect the application if a module remains
//  there with no references to it.

// The Node.js documents https://npmjs.org/doc/ have all the commands
// that you need to know with npm.

Example 2: how to uninstall npm packages

npm uninstall --save 
npm un 

Example 3: webpack uninstall npm

npm uninstall sax

Example 4: how to uninstall npm package

npm uninstall -g   //to uninstall globally

Tags:

Misc Example