Node.js development is more consistent and easy to integrate.
In this blog, I'll walk you through the installation process of
In my opinion, this is the best way to get
npm installed in your system. You can follow the same process for
Linux system. The best approach to install is through a tool called
nvm, which stands for "Node.js Version Manager".
nvm works at the level of an independent directory within your home directory which means that we can install different versions of Node.js without affecting the entire system. This is useful when different projects in your system required a different version of
You can find the nvm installation script from the project's GitHub page, you can use curl.
The version number highlighted here may differ
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.1/install.sh | bash
The above script will install the software into a subdirectory of your home directory at
~/.nvm. It will install and add all the necessary lines of code to your
~/.profile file in order to use the file.
In order to gain access to the nvm functionality, you'll need to either quit and start the terminal or run
source ~/.profile file so that your current session knows about the latest changes:
Once nvm is installed, you can now install different versions of
Node.js. For different versions of Node.js which are available type:
Output ... v14.9.0 v14.10.0 v14.10.1 v14.11.0 v14.12.0 v14.13.0 v14.13.1 v14.14.0 v14.15.0 (LTS: Fermium) v14.15.1 (Latest LTS: Fermium) v15.0.0 v15.0.1 v15.1.0 v15.2.0 v15.2.1 v15.3.0
As from the list above the current LTS version at the time of this writing is v14.15.1. You can install the latest LTS version by typing:
nvm install 14.15.1
nvm will switch to use the most recently installed version. You can use the version you just downloaded by typing:
nvm use 14.15.1
Node is the executable which we get upon installation of Node.js using
nvm. In order to see the version currently being used by the shell type:
npmis also installed along with
To check the current version of
In case of multiple Node.js versions installed, you can see what is installed by typing:
Output v12.18.1 -> v12.18.1
If you have decided to uninstall a version of Node.js that you have enabled using nvm, you'll first have to check if the version you'd like to remove is the currently active version. In order to determine the currently active version type:
If the version you are targeting to remove is not the current active version, then, you can run:
nvm uninstall node_version
The above command will uninstall the specified version of Node.js.
In order to remove the currently active version of
node you'll first have to deactivate
nvm to enable your changes:
Now, finally, you can uninstall the current version using the uninstall command above mentioned, it will remove and clean all files associated with the targeted version of Node.js.
There are quite a number of ways to get up and running with Node.js on your system. But in my opinion
nvm is the easiest method to get
node up and running easily. Using
nvm, it offers additional flexibility.
💌 If you'd like to receive more tutorials in your inbox, you can sign up for the newsletter here.