Installing Node.js and NPM is pretty straightforward using Homebrew. Assuming that you have Homebrew and XCode installed on your Mac, open Terminal and type
brew install node
To see if Node and NPM are installed, type
node -v
npm -v
To update Node and NPM, type
brew update
brew upgrade node
To uninstall Node and NPM, type
brew uninstall node