Installing Node.js for macOS
1. Open a new Terminal window
2. Enter the following command into the Terminal window and hit return
.
sudo rm -rf /usr/local/lib/node* /usr/local/include/node* /usr/local/bin/npm /usr/local/bin/node /usr/local/share/man/man1/node.1 /usr/local/share/man/man1/npm* /usr/local/lib/dtrace/node.d ~/.npm
You will be asked for your computer's password.
NOTE
The cursor will not move or change as you type the password. If you mistype, hit return
and try again.
3. Enter the following command into the Terminal window and hit return
.
brew install node
4. Close the Terminal window