ubuntu下npm全局安装包报错的解决方案

大概就是

npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ERR_STREAM_DESTROYED: Cannot call write after a stream was destroyed
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/keane/.npm/_cacache/tmp/0a654d27
npm ERR! errno -13
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1000:1000 "/home/keane/.npm"

之前一直没管直接就sudo完事,突然发现只要chown -R ${USER} 把对应目录的权限加上就好了

你可能感兴趣的:(ubuntu下npm全局安装包报错的解决方案)