See here
Nodesource PPA
This is the option for a recent nodejs installed systemwide
cd /tmp
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get update
sudo apt install nodejs
Node Version Manager
This is per-user (node no sudo)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Though I tend to move the additions to .bashrc into a separate script to keep things organised.