Install Node.js on Linux
Using NodeSource
Refer to the NodeSource documentation for more information on the available versions.
Node.js v14.x (legacy, 2021-era)
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
Upgrade npm
Note: This post reflects the 2021 setup. Node.js v14 is now EOL; use the current LTS for new installations.
Also, curl | bash should only be used if you trust the source.
npm install -g npm
Content licensed under CC BY-NC-SA 4.0.