Follow the steps below to get Node and NPM running cleanly on your machine.
npm uninstall npm -g
rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
rm -rf /usr/local/include/node /Users/$USER/.npm
rm /usr/local/bin/node
rm /usr/local/share/man/man1/node.1
rm /usr/local/lib/dtrace/node.d
2. Install NVM (node version manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
nvm install stable
nvm use --delete-prefix stable
nvm alias default stable
npm install npm -g
echo node: $(node -v) npm: $(npm -v)
# you're done!