The following setup avoids NPM errors during the @angular/cli installation (Unable to save binary /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/vendor/darwin-x64-51).

If needed, remove any old installation of node through the following commands:

rm -rf /usr/local/lib/node_modules
brew uninstall node

Indicate the directory where node modules will be stored through the prefix variable in a .npmrc file in your home directory:

echo prefix=~/.npm-packages >> ~/.npmrc

Install node.  This will automatically include NPM.

brew install node

Install the Angular CLI

npm install -g @angular/cli

With these steps npm will add the angular CLI module to directory ~/.npm-packages.  Since the directory is inside your home directory there is no need to execute the npm install command with sudo and doing so will cause errors because root will not have the rights to add files to the directory.

Finally, add the .npm-packages directory to the search path.  Without this, the ng command will not be recognized.

export PATH="$HOME/.npm-packages/bin:$PATH"