0

Starting to learn Nodejs in Ubuntu (New to ubuntu as well). when I use apt install nodejs , v8.x.x is getting installe instead of current v12.x.x. I tried to use nvm using from here but it is only installing node and not nodejs.

I tried to install from nodejs.org but it's just installing a tar package and I'm not sure how to install it or even if I'm able to install, do not find any easy way to update the node version.

Can someone provide me right way to install latest nodejs.

Thanks

0

3 Answers 3

1

NodeJS provides instructions for installing the latest versions of Node through various package managers on their website.

For Node.js v12.x:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
2
  • Thanks for the answer. Will the nodejs update to 13.x.x when released if I use sudo apt update and sudo apt upgrade.
    – Ran94
    Oct 4, 2019 at 4:52
  • I would imagine not as the provided repositories are linked to their major version number. Oct 4, 2019 at 17:33
0

Use the commands below:

sudo n list => show the list of installed versions sudo n stable => install latest stable version.

sudo n stable => install latest stable version

sudo n <version number> (ex: sudo n 12.18.3) to install the specific version of nodejs

Additionally, you can also use nvm (especially in case of Windows os, because above commands works on Linux) to install or switch between node versions.

0

Ubuntu now has Node.js in its default repositories that can be used to provide a consistent experience across multiple systems. you can install it via apt:

sudo apt update

sudo apt install nodejs

If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you’ll also want to also install npm, the Node.js package manager. You can do this by installing the npm package with apt as well:

sudo apt install npm

the build tools also avaiable here

sudo apt install build tools

Not the answer you're looking for? Browse other questions tagged or ask your own question.