How to install latest node version on Ubuntu?
Solution 1
This is very simple, Grab the Linux node distribution from here: https://nodejs.org/dist/v6.2.0/
Open Terminal and type below command:
sudo tar -C /usr/local --strip-components 1 -xzf ~/Downloads/node-v6.2.0-linux-x64.tar.gz
ls -l /usr/local/bin/node
That`s it.
Now check your node version by typing:
node -v
npm -v
One can install any version of node in Ubuntu using above steps.
Solution 2
There is official instruction:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Follow https://deb.nodesource.com/setup_6.x to read shell script before execute above commands.
You always must to know what you run, especially by sudo.
Solution 3
Any version of node install is very easy
Just click Node.js scroll down and go Installation instructions and chose which version you want to install
To Install 12.x version of node:
- Open your terminal [Ctrl+Alt+t]
- execute below command
Using Ubuntu
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
or
Using Debian, as root
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs
Solution 4
To remove previous version use command
sudo npm cache clean -f
sudo npm install -g n
and then for latest version
sudo n latest
Or for stable version
sudo n stable
Solution 5
By far the most convenient way to install and manage node versions on your machine is the Node Version Manager a.k.a nvm. Just follow the installation instructions in the repo and after you have it installed run
nvm install 6.2.0
Aman Gupta
I work as a software developer. Currently I am working on MEAN stack. I also have worked with Python and React js.
Updated on June 13, 2022Comments
-
Aman Gupta almost 2 years
I want to install the latest node (v6.2.0 at the time of writing) on Ubuntu. But as I do
sudo apt-get nodejs
This installed v0.10.37.
Can you please help me in installing the latest version of node js and also npm latest version?
-
Aman Gupta almost 8 yearsafter running these commands, node -v gives No such file or directory
-
vp_arth almost 8 yearsin ubuntu it becomes
nodejs
. Some naming conflicts. -
Aman Gupta almost 8 yearsthis also gives me 0.10.37 older version.
-
vp_arth almost 8 yearsYour legacy nodejs is still here. Run
/usr/bin/nodejs -v
and remove/usr/local/bin/nodejs
after success.. I don't know way to correct uninstall legacy nodejs, may beapt-get remove nodejs-legacy
-
vp_arth almost 8 yearsI can't to find
.deb
download by your link -
vp_arth almost 8 yearsAlso
sudo rm -rf $HOME/{local,lib,include,node*,npm,.npm*}
row inreinstall script
. Why want it to force(and silent) remove my~/lib
folder? -
Aman Gupta almost 8 yearsI have installed node v6.2.0. How do i install npm(the latest version)
-
vp_arth almost 8 yearsrun
npm -g install npm
twice -
Ashutosh Ranjan over 6 yearsSince node is installed @ /usr/local/bin/ we can use follwing command to remove node completely: rm -rf /usr/local/bin/node. This should work.
-
Rohan 'HEXcube' Villoth about 6 years@Shqear You've to close and reopen Terminal for the nvm command to be available