Check your current version: `node -v`
Check your package manager version if needed: `npm -v`
Update with Node Version Manager:
Install nvm if not installed
`nvm install node`
`nvm install –lts`
`nvm use node`
`nvm alias default node`
Update on macOS with Homebrew:
`brew update`
`brew upgrade node`
Update on Windows with nvm-windows:
Install nvm-windows
`nvm install latest`
`nvm use latest`
Update on Windows with installer:
Download the latest Node.js installer
Run the installer
Follow the prompts
Update on Ubuntu/Debian with NodeSource:
`curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -`
`sudo apt-get install -y nodejs`
Update on Fedora/RHEL:
`sudo dnf module reset nodejs`
`sudo dnf module enable nodejs:20`
`sudo dnf install nodejs`
Update using npm package manager:
`npm install -g n`
`sudo n stable`
`sudo n lts`
Verify the update:
`node -v`
`npm -v`
