How To Install Node.js and NPM on Ubuntu 18.04 LTS
Node.js is one of the most popular web technologies to build network applications quickly. In this guide, we’ll show you how to install Node.js and NPM on Ubuntu 18.04 LTS. We need to add Node.js PPA to your Ubuntu 18.04 LTS, 16.04 LTS, 14.04 LTS systems and install it. Same instructions you can apply for any Debian based distribution, including Kubuntu, Linux Mint and Elementary OS.
Install Node.js and NPM on Ubuntu with PPA #
There are several ways to install Node.js. However, we will show you the two simplest and most efficient way to install Node.js. Also, you can download the Node.js latest version via .rpm, .deb and Snap packages.
1. Add Node.js from NodeSource
This is the simplest method to install a specific version of Node.js. You can quickly follow the below steps to install Node.js 13.x, 12.x, 10.x version. To install Node.js and npm from the NodeSource repository, follow the below steps:
First, add the Node.js PPA to your system to install Nodejs on Ubuntu.
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
If you need to install any other version, change the version number. For example
2. Install Node.js on Ubuntu
Once the Node.js PPA is enabled, install Node.js using apt-get command. This will also install NPM with Node.js. Also, it will install the many other dependent packages on your systems.
sudo apt-get install -y nodejs
3. Check Installed Node.js and NPM version
Finally, Node.js and NPM successfully installed in your system. You can check and verify the installed Node.js version using the following command.
Similarly, you can check npm version using the following command.
Uninstall Node.js on Ubuntu #
If you want to completely remove Node.js and npm packages from your systems, execute the following command.
sudo apt-get purge nodejs npm
Finally, you can run the below command to remove any unused files and free up disk space.
sudo apt-get autoremove
We hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below. You can subscribe to our newsletter and get notified when we publish new articles for free. Moreover, you can explore here other interesting articles.
If you like our article, please consider buying a coffee for us.
Thanks for your support!
Buy me a coffee!