Remove existing brew installed node
brew uninstall --ignore-dependencies node
brew uninstall --force node
rm -f ~/.npm
brew update
brew install nvm
touch ~/.zshrc
Close and reopen your terminal window after this command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
if you're getting a There are insecure directories:
message right after, remove the group write access for them:
sudo chmod g-w /usr/local/share/zsh/site-functions
sudo chmod g-w /usr/local/share/zsh
nvm --version
nvm install node
npm i -g yarn