Installing latest NVM
First we need to check what is the latest version of NVM from github. We can go directly to https://github.com/creationix/nvm/releases and make note of latest release. At the time of writing it was v0.34.0, so that is version of NVM we are going to install.
First we will update packages and install
build-essential, which should be already installed, but in case it isn't
apt update apt install build-essential libssl-dev
Next we will download the nvm using curl and execute the install script:
curl https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
After this step we need a fresh terminal, so please close and reopen terminal to start using nvm. We can now validate that the nvm is installed correctly with command
which in my case outputs 0.34.0. Great. Now we can start to use it. I suggest, let's check all LTS (long term support) versions of nodejs and install the latest one
nvm ls-remote --lts nvm install 10.15.1
And that's it. As you can see we just installed latest version of Node.js and npm into our system. You can easily validate with commnads
stefan@ubuntu:~/$ npm -v 6.4.1 stefan@ubuntu:~/$ node -v v10.15.1
Once you install more versions you don't have to uninstall them, just switch the version using
nvm use 10.15.1 which will change version until you close terminal. If you want permanently switch to other version of nvm then just run
nvm alias default 10.15.1
Thank you attention. That's all for today.