If you still get error after running,
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then try to download and install command line tool from https://developer.apple.com/download/more/ for your particular Mac os and Xcode version.
Then try to run,
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and then
brew install node