how to upgrade node.js

C++
#linux
sudo npm install n -g
sudo n stable
#windows
#install the .msi from https://nodejs.org/en/download/#Run PowerShell as Admin

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
Source

Also in C++: