How to update Node.js
Check your current version:
node -v
Option 1: Official installer
Download the current LTS installer from nodejs.org and run it. It replaces the older version.
Option 2: nvm (Node Version Manager)
nvm install --lts nvm use --lts
nvm lets you keep several versions side by side. Install it from its official repository, following that page for your OS.
LTS means Long Term Support and is the usual choice for production.