All platforms (Mac, Linux, and Windows) 2024
If you just need to upgrade your old version of Node.js to the latest one and don't need multiple versions, simply overwrite your existing executable with the new one.

This just Works! TM on all platforms and is the easiest/fastest method.
When you run node -v in your terminal, you will see the the latest version.
Mac
If you originally installed Node.js using Homebrew, then run:
brew upgrade node
Managing multiple versions of Node.js
If you need to run multiple versions of Node.js on your machine, e.g., if you have an older project that targets a specific version on AWS Lambda, then NVM (Node Version Manger) is your friend!
Step 1 - Get NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
If you're curious about the installation command, read the source code. It’s been reviewed by several Node.js security experts.
Step 2 - Install the specific version of Node.js you need
Once you've got NVM, you can install a specific version of Node.js using the nvm command:
nvm install v22.16.0
Note: you may need to close and reopen your terminal window for nvm command to be available.
You should expect to see something like this in your terminal:
Now using node v22.16.0
You now have the latest Node.js on your machine.
And if you need to temporarily switch to a different/previous version, you can do it with a simple nvm command.
Note: avoid using sudo with Node/NPM as it violates the security principle of least privilege.
NVM is considered better than N for managing multiple Node.js versions because the verbose commands mean it is much easier to keep track of what you are doing in your Terminal/SSH Log. It is used by the team at NPM, the creators/custodians of the Node.js world!