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.

Revisions

  1. @dmythro dmythro created this gist Jul 1, 2014.
    5 changes: 5 additions & 0 deletions npm-uninstall-g.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/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