1

[Update: see the bottom of the question] I have one system where lots of npm packages have been installed over time. I did try to update outdated ones and it seemed to do it but I still have some problems with setting up one project (the npm run setup command freezes at some point). I tried it on another system (both latest OS X) where npm was only recently installed and has just a few necessary global packages. As the old system has a lot of unnecessary node packages/modules (I used to install things globally), I'm thinking of removing all the npm packages, cleaning all the related caches and starting from scratch installing globally only the npm packages I need.

How can I delete all npm packages and clean the system of all remaining config/cache related to npm?

EDIT: I have run the command from the other thread and also deleted the .npm folder from the home directory and reinstalled npm I have done:

npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
  • deleted the ~/.npm (no .npm-global)
  • ran npm explore npm -g -- sh scripts/clean-old.sh

Now when I'm running 'npm list' I get a long list of:

npm ERR! missing: xxx-package details

which I assume were all the packages that used to be installed. It means that there's more to it, so kind of config/cache.

Thank you

Wasteland
  • 4,889
  • 14
  • 45
  • 91
  • 1
    Does this answer your question? [Command to remove all npm modules globally?](https://stackoverflow.com/questions/9283472/command-to-remove-all-npm-modules-globally) – Ken Y-N Oct 02 '20 at 05:37
  • I think so - is there any cache that needs to be cleaned apart from that? – Wasteland Oct 02 '20 at 05:50

0 Answers0