When I try to do this:
brew install node
I get this message:
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19:
As this thread suggests at some point, my problem was to run brew command with sudo privileges for the first time. This causes brew to try to access privileged files and folders and it fails. If that's the case for you, run these commands and try installing node again.
sudo chown -R "$USER":admin /usr/local
brew cleanup