How to remove all globally installed npm modules

How to remove all globally installed npm modules

In this post we will give you information about How to remove all globally installed npm modules. Hear we will give you detail about How to remove all globally installed npm modulesAnd how to use it also give you demo for it if it is necessary.

we are going to learn about how to remove all globally installed npm modules from your system.

Removing specific npm module

To remove a specific npm module, you need to run npm uninstall -g command followed by the module name.

Here is an example that removes the globally installed react module.

npm uninstall -g react

Removing all npm modules

To remove all npm modules from your system, you can use the following command.

npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !//npm$/ {print $NF}' | xargs npm -g rm

This above command scans all globally installed npm modules and removes each module by running npm -g rm

Note: This above command works on Linux, macOS and anywhere you are using Linux environment.

For windows, you need to open the following folder and delete all contents present in that folder.

C:UsersusernameAppDataRoamingnpm

or you can open that folder by searching the following path inside the explorer.

%appdata%/npm

Hope this code and post will helped you for implement How to remove all globally installed npm modules. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US