List & clean globally installed npm packages

Nodejs packages can be daunting sometimes. When you are knee deep developing Nodejs projects, you will have tons of packages installed globally. Its good to clean up those unwanted packages regularly to keep your disk clean and neat!

List Packages

The following command will list all the global packages installed.

npm list -g --depth 0

This will result in an output something like this

$ npm list -g --depth 0
├── @angular/cli@8.0.3
├── caprover@1.2.0
├── expo-cli@2.21.2
├── express-generator@4.16.1
├── node-red@0.20.0
├── nodemon@1.19.1
├── npm@6.9.0
├── npm-check-updates@3.1.11
├── pm2@3.5.1
├── react-native-cli@2.0.1
├── react-native-rename@2.4.0
└── watchify@3.11.1

Remove Global Package

From the global packages list above, say we want to remove the caprover package. We can use the below command to do the same

npm r -g caprover

That’s it! Make it a regular schedule to clean up your npm packages to clean your disk clean and lean.


Add a Comment

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.