This can be caused by installing anything with npm using sudo
-- this causes the files in the cache to be owned by root, resulting in this problem. You can fix it by running:
sudo rm -rf ~/.npm
to remove the cache. Then try whatever you were doing again, making sure you never use sudo
along with npm
(or the problem may come back).
Lots more information: npm throws error without sudo