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
 root@localhost:~  yum install epel-release
root@localhost:~ yum install npm
On Ubuntu 16/18 and Debian 10

root@localhost:~  apt install npm  

On Ubuntu 20

root@localhost:~  apt-get update

root@localhost:~  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 : 

root@localhost:~ npm config set registry 

root@localhost:~  npm install -g n   

3. Install node by running :

Add insecure to install without ssl : 

root@localhost:~ n --insecure latest

For example : n --insecure  v12.13.0


   To install the latest version: 

     root@locallhost:~ n latest

To install corresponding version :

     root@localhost:~ n version.number

For example,   root@localhost:~   n  v12.13.0


To switch between multiple node versions you need to run : 

root@jumpserver:~#  n