How can I uninstall npm
modules with devDependencies in Node.js?
First, you must delete the dependency from your node_modules/ folder, and second, remove its listing from your package. json. This ensures the package is fully removed. Instead of performing this task manually, we can use the npm uninstall command.
Uninstall all global npm packages If you want to uninstall all global packages, then you need to name the packages one by one in the npm uninstall -g command. Run the npm list -g --depth=0 command to list the packages installed globally on your computer. That should uninstall all global packages for you.
Use command:
1)npm uninstall <name of the module>
Also you can use:
1) npm uninstall <name of the module>
: to remove the module from node_modules, but not package.json
2) npm uninstall <name of the module> --save
: to also remove it from dependencies in package.json
3) npm uninstall <name of the module> --save-dev
: to also remove it from devDependencies in package.json
4) npm -g uninstall <name of the module> --save
: to remove it globally
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With