0

i tried a lot to install latest version of nodejs and i followed instruction in their website here Installing Node.js via package manager

i have ubuntu 16.04LTS operating system. when i try this command

nodejs -v

to check version i installed.i expected it will be 9.9.0 but i found it is v4.2.6 i also tried this command sudo apt-get install nodejs-legacy but the result still the same. so how can i install the latest version of nodejs

thanks for all of you

2 Answers2

0

When you want to install from apt-get, you found in repo and you will install the latest version in repo. I think that install nvm is the best option:

https://github.com/creationix/nvm

you can easily change the node version =)

aperdizs
  • 106
  • 6
  • i followed [this answer]https://stackoverflow.com/a/41196107/6479099 but now what is the difference between this two commands ~$`nodejs --version` v4.2.6 ~$`node --version` v9.9.0 – Mohammed hakeem Mar 28 '18 at 13:06
  • @Mohammedhakeem I think that the user added other repo with the last node version =) – aperdizs Mar 28 '18 at 13:11
0

You can find good tutorial on godady site. Install latest version by using a PPA and just replace '9' by '7' in add repository like below command

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

then go forwards to update apt-get and install nodejs.

Majid
  • 39
  • 1
  • 11