However there is a quick fix for this. You simply need to run the following two commands in terminal:
sudo chown -R `whoami` ~/.npm sudo chown -R `whoami` /usr/local/lib/node_modules
These commands give the current user ownership of the “npm” and “node_modules” directories, allowing you to use npm without sudo. Sweet.