Remove all global npm modules
Removes all global NPM modules by listing all the global top level modules, and removing all modules that are not actually NPM itself (i.e. don't end with "/NPM")
Authored by: Kai SternadBrought to you by Warp, a free terminal reimagined to work like a modern app.
Command
Copy
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
Tags
Edit in GitHub
Copied