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 ?
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 :
- Remove the old version
sudo apt-get remove --purge node
- Download Node binaries from https://nodejs.org/en/
- Extract the archive where you want
tar -xzf <ARCHIVE>.tar.gz -C <YOUR_FOLDER>
- Create a node symbolic link
ln -sf <YOUR_FOLDER>/bin/node /usr/bin/node
- 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 !
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
To install the NodeJS any version
# you can replace number 6 with new version
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt install nodejs
node -v