How to fix Error: ENOENT lstat npm when trying to install modules

So last week I was trying to install some node modules from and use the global install option sudo npm install <package_name> -g. For some reason I got this weird error: npm ERR! Error: ENOENT, lstat.

I was trying to figure out why and did reinstall my node+npm to fix that but no luck. I thought I have to reinstall my Mac OS X Mavericks since many people had the same problem and they have to fix it by doing that. Luckily I found a thread on github issue on npm with the same, or similar problem.

Note: This might not fix your problem but it doesn't hurt to try this at all.

All I have to do was:

npm cache clean  

That will clear and clean bad installed package on your node_modules and causes the process of installing the module exit with an error.

So, basically the npm install didn't complete because of the exit with error. The npm cache clean will remove that bad package from the process, and then you can do npm install <package_name> -g again and it should pass this time :)

If you had the same problem and fixed it with other way please do share them :)