A few system packages are needed:
sudo
.
apt-get update
apt-get -y install curl nginx lsof build-essential git
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
npm i -g pm2 dotenv-cli
pm2 install pm2-logrotate
# allow pm2 to start on reboot (need sudo if you are not running as root)
pm2 startup
You can check the node version by running node --version
.