Created
February 1, 2019 20:34
-
-
Save bolencki13/9559237da4f0e9dab4ae1374ccb8adb7 to your computer and use it in GitHub Desktop.
Remove all global npm packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm r -g $(node -e "console.log(process.argv.filter((e) => e !== '├──' && e !== '└──').filter((_, i) => i > 1).map((e) => e.split('@')[0]).filter((e) => e !== 'npm').join(' '))" $(npm list -g -depth 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm r -g (node -e "console.log(process.argv.filter((e, i) => e && i > 1).map((i) => i.split(' ')[1].split('@')[0]).filter((i) => i !== 'npm').join(' '))" (npm list -g -depth 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple script that removes all npm packages. This was tested on macOS using both Fish & Bash shells.