Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs always installing 4.2.6

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

like image 969
AmDGrtst Avatar asked Aug 09 '17 07:08

AmDGrtst


2 Answers

In Linux/Mac systems, there is no better way than nvm - Node Version Manager.

Install:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

Then, usage is as simple as:

nvm install 8.0
nvm use 8.0

If after reboot you will see old version, use nvm alias to set your version as default one.

Note: If you're a happy user of new M1 Apple chip, install version 15 of Node.js with nvm, it supports it out of the box.

like image 176
Lazyexpert Avatar answered Oct 21 '22 00:10

Lazyexpert


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.

like image 40
arc lightning Avatar answered Oct 21 '22 00:10

arc lightning