Nodejs always installing 4.2.6

Viewed 13640

I am installing latest version of nodejs in my localhost. But system is always installing the 4.2.6 version.How can i install the latest version.

Commands i have used:

sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

After installing i have checked:

node -v

Result:

v4.2.6

Output of apt-cache policy nodejs:

Installed: 4.2.6~dfsg-1ubuntu4
Candidate: 4.2.6~dfsg-1ubuntu4
Version table:
*** 4.2.6~dfsg-1ubuntu4 500
    500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 
Packages
    100 /var/lib/dpkg/status

OR

Can anyone send the installation steps for installing from

node-v8.2.1-linux-x64.tar.xz 

file.

Thanks

5 Answers

Hey guys if you have Ubuntu 16 try this instructions. It worked for me perfectly.Also provide your account password whenever asked in this process.

  1. sudo su -c "echo 'deb https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list"

  2. sudo su -c "echo 'deb-src https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list"

  3. sudo apt-get update

  4. apt-cache policy nodejs Check if the versions listed has node 8

  5. sudo apt-get install nodejs

  6. nodejs -v check the node version installed

This shall successfully install nodejs version 8 on your system. If you wish any other version, then change the version on step 1 and 2 it shall work successfully.

sudo rm -rf /var/lib/apt/lists/*

sudo rm -rf /etc/apt/sources.list.d/*

sudo apt-get update

#Use this to remove the Previous Nodejs from Your device and then try again with Installing NVM

Related