Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Node 6.9 on Ubuntu Zesty 17.04

I want to install a newest version of NodeJS on Ubuntu Zesty 17.04. But whether using apt-get or trying to download it from nodesource ppa, I always have the version 4.7.2.

Apt-get

sudo apt-get update
sudo apt-get install nodejs npm

Node PPA

curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get update
apt-get install nodejs npm

Result

$> node -v
v4.7.2

How can I get the version 6.9 of NodeJS ?

like image 516
Radouane ROUFID Avatar asked Apr 24 '17 14:04

Radouane ROUFID


2 Answers

Best way is to use n. It is a node module that helps you to update and switch between node versions easily.

npm install n --global

n list will list all node versions.

If you want to switch to new version 6.10.2 use command n 6.10.2

like image 94
Harikrishnan Avatar answered Sep 25 '22 03:09

Harikrishnan


I didn't succeed to install it via apt-get or nodesource ppa. However I solved the problem by installing Node manually by following these steps :

  1. Remove the old version sudo apt-get remove --purge node
  2. Download Node binaries from https://nodejs.org/en/
  3. Extract the archive where you want tar -xzf <ARCHIVE>.tar.gz -C <YOUR_FOLDER>
  4. Create a node symbolic link ln -sf <YOUR_FOLDER>/bin/node /usr/bin/node
  5. Create a nodejs symbolic link ln -sf <YOUR_FOLDER>/bin/node /usr/bin/nodejs

result :

radouane@roufid:$ node -v
v6.10.2

I hope it helps !

like image 23
Radouane ROUFID Avatar answered Sep 24 '22 03:09

Radouane ROUFID