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 Sternad

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