Open In App
Related Articles

How to remove all Global Modules in Node.js ?

Improve Article
Save Article
Like Article

Node.js is an open-source and cross-platform runtime environment for executing JavaScript code outside of a browser. You need to remember that Node.js is not a framework and it’s not a programming language. Most of the people are confused and understand it’s a framework or a programming language. We often use Node.js for building back-end services like APIs like Web App or Mobile App. It is used in production by large companies such as Paypal, Uber, Netflix, Wallmart, and so on.

We can remove all the module globally in Node.js by the following ways:

For Linux (Ubuntu) users: In order to uninstall the globally installed package_name package, the following command can be used (using sudo if necessary, depending on your setup and permissions).

sudo npm rm --global package_name

To check whether the package is installed globally or not, use below command:

npm ls --global packae_name

Below images display the use of above command to uninstall express package globally:

For Window users: The Windows user can remove all the Node.js modules globally by just deleting the content of the following directory:


Steps to remove Global Modules:

  1. Press win + r (win = Windows button) from keyboard and a dialog box will appear as shown below:
  2. Now type %appdata%/npm in the text field and press enter button as shown below:

    The directory will have files and folders as shown below:

  3. Now delete the content of this directory.

All the global node modules are removed properly.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 01 Jul, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials