I recommend that you use nvm. It's a lot easier and eliminates the hassle of updating.
nvm
To do this, you can install nvm. https://github.com/nvm-sh/nvm#installing-and-updating
you will be pasting in the curl command curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Note: when this is finished running, you should see a line near the bottom which says something like export NVM_DIR="$HOME/.nvm"
Copy and paste this and hit enter.
Then check to make sure you have nvm installed now nvm -v
Nodejs update
After, in the terminal, type: nvm install node (you can also check your current version first with node -v
Run it and then check node version again. It should be updated.
npm
While you're at it, you can also update npm.
Check version npm -v Update npm install -g npm
This should do it. Let me know if there are any issues. Note: this can all be done in the -zsh shell, no reason to move back to bash.