A 'non corrupted global cache' is not the same as a 'non broken node_modules
' for a particular project.
Just got this when trying to run a simple Angular CLI command (Windows):
An unhandled exception occurred: Cannot find module './formats/index'
I verified the global cache was ok with:
npm cache verify
Then I deleted the contents of nodule_modules
and ran npm install
and everything worked again.
Not sure if there's an equivalent to cache verify
for a project's node_modules, but I've had to purge it many many times. But it's good to verify the cache is sound first.