
use Node Version Manager – NVM, check in console
nvm -v
For install nvm use Homebrew use command. If you don’t have Homebrew, you have installed Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" echo "# Homebrew\nexport PATH=/opt/homebrew/bin:\$PATH" >> .zshrc source ~/.zshrc
Install NVM (Node Version Manager) on macOS
brew update brew install nvm mkdir ~/.nvm echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc source ~/.zshrc
Commands
nvm ls #=== List installed versions, matching a given <version> if provided nvm install --lts #=== When installing, only select from LTS (long-term support) versions (Installing latest LTS version. v18.16.0 is already installed.) nvm install 16.20 #=== Downloading and installing node v16.20.0 nvm use v18.16.0 #=== Now using node v18.16.0 (npm v9.5.1) nvm use v16.20.0 #=== Now using node v16.20.0 (npm v8.19.4)