Skip to content

Instantly share code, notes, and snippets.

@marcusdb
Created September 26, 2017 16:07
Show Gist options
  • Save marcusdb/2ffd063dc4fd9bc03d79593fd856ea65 to your computer and use it in GitHub Desktop.
Save marcusdb/2ffd063dc4fd9bc03d79593fd856ea65 to your computer and use it in GitHub Desktop.
up vote
336
down vote
accepted
The following command removes all global npm modules. Note: this does not work on Windows. For a working Windows version, see Ollie Bennett's Answer.
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment