Open the Terminal by either searching for it in the launcher or by using the shortcut
Ctrl + Alt + T
.Update your system by running the command:
1
sudo apt update
Install the prerequisite packages that are needed to run Node.js:
1
sudo apt install curl wget
Download and install the Node.js package by running the following commands. Replace the
XX
with the version number you wish to install.1
2curl -sL https://deb.nodesource.com/setup_XX.x | sudo -E bash -
sudo apt install -y nodejs
For example, if you want to install version 14, you would enter:
1 | curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - |
- Verify the installation using the following command:This should display the version number of Node.js that you have installed on your system.
1
node -v
That’s it! You have successfully installed Node.js on your Ubuntu system.