Skip to Content

How to install node using npm and n module?

 Install node using npm and n module
1. Install npm
  On centos 7
 [email protected]:~  yum install epel-release
[email protected]:~ yum install npm
On Ubuntu 16/18 and Debian 10

[email protected]:~  apt install npm  

On Ubuntu 20

[email protected]:~  apt-get update

[email protected]:~  apt install npm

2. Install n, Node’s version manager:

 If you are not using ssl, you need to set the repo to http by running : 

[email protected]:~ npm config set registry 

[email protected]:~  npm install -g n   

3. Install node by running :

Add insecure to install without ssl : 

[email protected]:~ n --insecure latest

For example : n --insecure  v12.13.0


   To install the latest version: 

     [email protected]:~ n latest

To install corresponding version :

     [email protected]:~ n version.number

For example,   [email protected]:~   n  v12.13.0


To switch between multiple node versions you need to run :