To uninstall a package you have previously installed locally (using
npm install <package-name> in the
node_modules folder, run
npm uninstall <package-name>
from the project root folder (the folder that contains the node_modules folder).
-S flag, or
--save, this operation will also remove the reference in the
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
npm uninstall -g <package-name>
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.