install nodejs in ubuntu

sudo apt-get install curl

 

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -

OR
 

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

OR
 

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

OR

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get install nodejs

node -v

npm -v