To install Node.js on Linux we recommend NVM (Node Version Manager), which lets you install several Node.js versions and move between them.
Install NVM
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bashAfter the installation, reconnect to SSH or run:
. ~/.bashrcNVM is now available through the nvm command.
Useful commands
View the installed Node.js versions:
nvm listCheck which version is currently in use:
nvm currentnvm versionInstall the version you want:
nvm install <nodejs_version>Switch version (only useful if several versions are installed):
nvm use <nodejs_version>Set a default version:
nvm alias default <nodejs_version>