Skip to content

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 install command. 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
See also  Prevent your node.js server from crashing on production

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.