The following will probably also work on a Mac.
Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Then reload the shell configuration
source ~/.bashrc
Check that nvm is installed
nvm -v
Install Node
Use nvm to install the version of node needed. For example:
nvm install 18
Check that node is installed
node -v
Done!