How to Install Node.js with npm on Linux Mint 19

Table of Contents
Install Node.js with npm on Linux Mint 19
In this tutorial, we are going to learn how to install Node.js with npm on Linux Mint. Node.js is the opensource JavaScript Run-time environment for server-side execution of JavaScript code. Node.js built on Chrome’s V8 JavaScript engine so it can be used to build different types of server-side applications.
npm is the world’s largest software registry for Node.js packages with thousands of packages available. Where npm stands for Node Package Manager which is the default package manager for Node.js.
In this tutorial we will install Node.js in following three ways:
- Install Node.js and npm using Linux Mint repository
- Install Node.js and npm using nvm
- Install Node.js from the NodeSource repository.
Prerequisites
Before you start to install Node.js and npm on Linux Mint 19. You must use the credentials of the user with sudo privileges.
Install Node.js and npm on Linux Mint
You can install Node.js and npm on Linux Mint in the following three ways. For installation, you can use any of the following way.
1. Install Node.js and npm using Linux Mint repository
First, Update Linux Mint apt package manager index by running the following command.
sudo apt update
Install Node.js from Linux Mint global repository by typing
sudo apt install node
Confirm the installation of Node.js by typing
node --version

Install npm by running following command
sudo apt install npm
Confirm the installation of npm by typing
npm --version

2. Install Node.js and npm using nvm
NVM stands for Node Version Manager which is used to manage multiple Node.js versions. If you want to install or uninstall different versions of Node.js then NVM is there for you.
First, we will install NVM (Node Package Manager) on your system. So download the NVM installation script running the following command.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Check nvm version and confirm installation typing:
nvm --version
Now install Node.js by using the following command:
nvm install node
Verify Node.js installation by typing
node --version
The output should be:
v10.14.0
You can install multiple versions of Node.js. To do so type following:
nvm install 8.14
nvm install --lts
nvm install 11.3
To list all the versions installed run following command.
nvm ls
You can change the current default version of Node.js by using the following command.
nvm use 8.14
To uninstall a Node.js version type following command
nvm uninstall 11.14
3. Install Node.js from NodeSource Repository
NodeSource company provides enterprise-grade node support also maintains the repository containing the latest version of Node.js.
To enable the NodeSource repository on your system run following command.
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
NOTE: The latest LTS version of Node.js is 10.x if you want to install 8.x version then just replace setup_10.x
with setup_8.x
Now install Node.js and npm package typing.
sudo apt install nodejs
Verify installation of Node.js and npm running following command
node --version
npm --version
Install Development Tools
Now install some packages needed for development by running following command
sudo apt install gcc g++ make
Uninstall Node.js and npm
Uninstall Node.js use following command
sudo apt remove nodejs npm
sudo apt autoremove
To uninstall node.js version using nvm type following command
nvm uninstall 10.14
Conclusion
You have successfully learned how to install Node.js with npm on Linux Mint 19. If you have any queries dont forget to comment below.
LATEST POSTS
-
How to Install Kodi on Debian 10
-
How to Install phpMyAdmin on Linux Mint 19
-
How to Install Yarn on Linux Mint 10
-
How to Install Go on CentOS 7
-
How to Install Java on Linux Mint 19
-
How to Install PostgreSQL on Ubuntu 18.04
-
How to install LAMP stack on Debian 9
-
How to Save a File in Vim or Vi and Quit the Editor
-
How to Install Docker Compose on CentOS 7
-
How to Reboot Linux System with Command Line
-
How to Install Opera Browser on Ubuntu 18.04
-
How to Install Atom Editor on Ubuntu