Uninstalling npm packages

To uninstall a package you have previously installed locally (using npm install <package-name> in the node_modules folder, run

BASH
npm uninstall <package-name>

from the project root folder (the folder that contains the node_modules folder).

Using the -S flag, or --save, this operation will also remove the reference in the package.json file.

package.json will be automatically updated with devDependency and dependency once you uninstall npm package.

If the package is installed globally, you need to add the -g / --global flag:

BASH
npm uninstall -g <package-name>

for example:

BASH
npm uninstall -g webpack

and you can run this command from anywhere you want on your system because the folder where you currently are does not matter.

    Contributors
  • flaviocopes
  •  MylesBorins
  •  fhemberger
  •  LaRuaNa
  •  ahmadawais