How to uninstall npm modules in node.js?

In this small post, find out how to uninstall npm packages from a node.js project or globally. Any npm package can be installed easily using the npm installcommand. But most of the times we ignore the installed package and forget about them. How do we uninstall npm modules? Read on.

Syntax

The syntax to uninstall npm packages is

npm uninstall <package-name>

Examples

npm uninstall mongoose
npm uninstall winston

To uninstall globally, just use -g flag.

npm -g uninstall winston

Uninstall multiple npm packages

To uninstall multiple npm packages, separate them by space.

npm uninstall mongoose winston

2 thoughts on “How to uninstall npm modules in node.js?”

Comments are closed.