To install a specific version of Node, and even use multiple versions you can use nvm.

brew install npm

curl -o- | bash

Be carfull if you hare behind a proxy

After installtion is done, you can open a new terminal window and run nvm install v12.3.1 to install version 12.3.1 or any other version. Check available versions with nvm ls-remote

After instalation is done, you can switch node version with nvm use nvm 12.3.1

Run node -v to confirm everything is ok.