How to Install Node.js on Linux Mint

This quick how-to guide provides you with two methods to install Node.js & NPM on Linux Mint 21, 20, and 19 Linux systems.

Method 1 – Installing Node.js with Official PPA

First of all, you need to node.js PPA in our system provides by Nodejs official website. We also need to install the python-software-properties package if not installed already. You can choose either to install the latest Node.js version or the LTS version. For Latest Release For LTS Release For this tutorial, I have added the latest release Apt repository on my Linux Mint system. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

Method 2 – Installing Node.js with NVM

NVM provides a shell script for the installation on the Linux system. So, execute the installer script with the below commands. This will install the nvm command on your system. Now, load the nvm environment in the current shell with the below command. NVM is successfully installed on your system. Now you can install any node.js version with the help of NVM. You can run the above command with different 2 versions to install any number of Node.js on your Linux Mint systems. For example, you can use nvm install 17 or nvm install 12.18, etc. The systems have multiple node.js versions installed, can use the below command to set any installed node.js version as an active version. You can find detailed instruction’s about the node.js installation in our previous tutorials. Find more details about Node.js installation via NVM.

How to Check Default Node.js Version

After completing the installation process of node.js, Let’s check and verify the installed version. You can find more details about the current version on node.js official website. Also, check the version of NPM.

Don’t Miss => Yarn Installation ( A Node Modules Manager)

Step 4 – Create A Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js and add the following content Now start the web server using the command. The web server has been started on port 3000. Now access URL in the browser.