remove unnecessary npm packages

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

Also in C++: