DEV Community

Atila Santiago
Atila Santiago

Posted on

2º Best Way To Install NodeJs (Linux)

If you, even like me, don't got installing the last version of the Nodejs following the steps in the Nodejs.org, i wanna show to you a other way to resolve this problem.

Basicaly we will use the NVM(Node Version Manager), him will permited us to use diferent versions of Nodejs, and also choose the LTS(Latest) version we require.

1) Install the requered libs.

  sudo apt update
  sudo apt-get install build-essential libssl-dev

2) Install de NVM

 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash

This scrip will install the NVM, you must confirm the number of the version before install, he will install in a ocult folder in your HOME directory.

3) List and install the version of Nodejs you will want:

 nvm ls-remote

This will show a list of all versions of Node. Choose the one you want, the last latest version, per example, and install her, like that:

 nvm install v12.16.1

Some observations:

//In case you install other versions of Nodejs and want switch between them 
   nvm use -version-
//To verify the version of Node
   node -v
//If necessary update the NPM(Node Package Manager) that came with the node 
   npm i npm -g

And that's about it, i hope this will help someone, like was help me fill days ago.

This was the article that helped me initially.

Top comments (0)