NPM errors and common cures

“npm ERR! error rolling back socket.io@0.9.16”

remove ~/.node-gyp and clean npm cache by npm cache clean, then try again.

source