Skip to content

Instantly share code, notes, and snippets.

@shawn-dsz
Forked from dmythro/npm-uninstall-g.sh
Created February 13, 2018 00:34
Show Gist options
  • Select an option

  • Save shawn-dsz/fbe51568abff8b7a417bd3956cfc0ee5 to your computer and use it in GitHub Desktop.

Select an option

Save shawn-dsz/fbe51568abff8b7a417bd3956cfc0ee5 to your computer and use it in GitHub Desktop.
NPM: Uninstall all Global modules
#!/bin/bash
# Uninstall all Global modules from NPM
# http://stackoverflow.com/questions/9283472/command-to-remove-all-npm-modules-globally
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment