In my case, the above alone didn't work. I had installed and uninstalled several versions of nodejs to fix this error: npm in windows Error: EISDIR, read at Error (native) that I kept getting on any npm command I tried to run, including getting the npm version with: npm -v
.
So the npm directory was deleted in the nodejs folder and the latest npm version was copied over from the npm dist: and then everything started working.