How to remove all Global Modules in Node.js ?
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:
- Press win + r (win = Windows button) from keyboard and a dialog box will appear as shown below:
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:
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!