I followed the previous answers and reinstalled node. But I got this error.
Warning: The post-install step did not complete successfully You can try again using
brew postinstall node
So I ran this command
sudo chown -R $(whoami):admin /usr/local/lib/node_modules/
Then ran
brew postinstall node