How to clear the npm cache on a Mac
SHORT ANSWER
npm cache clean --forceIt only deletes downloaded packages. Your projects keep working; npm downloads what it needs on the next install.
1. Check how big it is
npm keeps its cache in a hidden folder in your home folder.
du -sh ~/.npm/_cacache
2. Clear it
npm asks for --force because the cache repairs itself and rarely needs clearing by hand.
npm cache clean --force
3. Check it worked
npm cache verify
Is it safe?
Yes. The cache only holds copies of packages from the registry. Nothing in your projects' node_modules changes.