To install Node.js and NPM on Ubuntu 18.04, you need to add Node.js PPA to your Ubuntu 18.04 LTS, 16.04 LTS, 14.04 LTS system and install it. The steps involved can also be applied to any Debian-based distribution, including Kubuntu, Linux Mint, and Elementary OS.
Node.js is an open-source technology compatible with various platforms. It is utilized by many developers to enhance the functionality of web applications. The primary benefit of Node.js is server-side execution, allowing JavaScript to operate without a client machine.
I. Guide to Node.js and NPM on Ubuntu 18.04.
1. Add Node.js from NodeSource.
2. Install Node.js on Ubuntu.
3. Check the version.
II. Uninstallation Guide.
I. Guide to Node.js and NPM on Ubuntu 18.04, Linux
There are several ways to install Node.js. However, Mytour will guide you through the simplest and most effective method. You can download the latest version of Node.js via .rpm, .dep, and Snap packages.
1. Adding Node.js from NodeSource
This is the simplest method to install a specific version of Node.js. You can quickly follow the steps below to install Node.js versions 13.x, 12.x, and 10.x.
First, add the Node.js PPA to your system to install Node.js on Ubuntu.
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
If you need to install any other version, simply change the version number, such as 12.x, 10.x.
2. Installing Node.js on Ubuntu
Once the Node.js PPA is activated, you can install Node.js using the apt-get command. This will also install NPM along with Node.js. Additionally, it will install many other dependencies on your system.
sudo apt-get install -y nodejs
3. Checking the Installed Node.js and NPM Version
Finally, Node.js and NPM are successfully installed on your system. You can check and confirm the installed Node.js version using the following command:
node --version
Similarly, to check the NPM version, you can use the command:
npm --version
II. Uninstalling Node.js on Ubuntu
If you want to completely remove all Node.js and NPM packages from your system, simply execute the following command:
sudo apt-get purge nodejs npm
Finally, run the command below to delete all unused files and free up storage space.
sudo apt-get autoremove
With just a few simple steps, you can successfully install Node.js and NPM on Ubuntu 18.04. Additionally, this article provides an easy way to uninstall them if needed. Check out our guide on How to Install GIMP on Ubuntu 18.04 here to utilize this image editing software, which can be compared to Photoshop.
