All my brogrammers in 2026 hate NPM. If you don't need the latest, consider apt install nodejs npm instead.
Check the latest version at https://nodejs.org/en/download ; select Linux and x64 architecture, then copy the Standalone Binary button link address.
Log in to WSL and download it:
wget https://nodejs.org/dist/v24.16.0/node-v24.16.0-linux-x64.tar.xz
Verify the checksum:
wget https://nodejs.org/dist/v24.16.0/SHASUMS256.txt
sha256sum --check SHASUMS256.txt --ignore-missing
Expected output:
node-v24.16.0-linux-x64.tar.xz: OK
Install to the local user:
mkdir -p ~/.local/nodejs
tar -xf node-v24.16.0-linux-x64.tar.xz -C ~/.local/nodejs --strip-components=1
Edit your bash resource file and include in your path
vi .bashrc
export PATH="$HOME/.local/nodejs/bin:$PATH"
source .bashrc