Skip to content

Instantly share code, notes, and snippets.

View zprima's full-sized avatar

Primož Žnidar zprima

  • @poviolabs
  • Slovenia
View GitHub Profile
@zprima
zprima / remove_npm_with_ruby
Last active July 1, 2018 08:55
Ruby script to remove npm modules globally
File.open("li.txt", "w")
File.truncate("li.txt", 0)
system("npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' >> li.txt")
npm_modules = []
File.open("li.txt").each do |line|
next if line.start_with?('│') || line.start_with?('├') || line.start_with?('└')
npm_modules << line