Linux Nodejs version managing

on Ubuntu when you install Nodejs some times it doesn't install the LTS version
> for me the Nodejs version was only installing 10.xx.x

most of developers that using Nodejs on Linux will know how to fix this, but some new comers would have a trouble so I will post a way to install NVM(Node Version Manager)

Installing

first if you installed Linux( I will explain based on Ubuntu) recently and never used the command curl
than you will need to

sudo apt install curl

after that we need to run the NVM installer

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 

after that you will need to logout and login to load the environment

now we will install node using NVM

nvm install node

this is the command that install the latest version of node, and if you want you can specific version of node using

nvm install 12.19.0

Using

nvm ls

this is the command that can find the installed versions of node

nvm ls-remote

this is the command that can find to available nodejs versions

nvm use xx.xx.x

this is the command that can select a different version of node

nvm run default --version 

you can also run this to find the default version of node of your system

nvm exec xx.xx.x server.js 

you can also use this to run a node script with a specific version of node