Fixing a broken npm update


If you install node and npm using homebrew and later attempt to update npm using the following command you may find yourself “losing” your npm installation at the terminal.

npm update -g npm

The problem is caused by npm not playing well with the homebrew installation when trying to update itself. After finding myself in this situation and following various accepted answers on StackOverflow without success, I eventually came across this gist on github that worked for me. There’s a great explanation of the details of the issue or you can just dive straight into the solution.


EACCES error on npm install with mean-cli


When generating a new mean application using the mean-cli generator available from you may get the following error:

EACCES, mkdir '/Users/darren/tmp/npm-NNNNNNNN

Where NNNNNNNN is a random alpha numeric.

This is caused by the tmp folder being owned by root when it should be owned by the user (darren). To fix this execute the following in the terminal.

sudo chown -R `whoami` ~/tmp