Question: I have installed nodeJS on Ubuntu with following code 

```
sudo apt-get install nodejs

```

Since I am a new user for ubuntu I also ran this code too

```
sudo apt-get install npm

```

Now when I type 

```
 nodejs --version

```

It shows 

```
v0.6.19

```

I checked and saw latest nodeJS version is `0.10.26` 

How can I update my version of nodeJS to `0.10.26`?

I tried with 

```
 sudo apt-get install <packagename>
 sudo apt-get install --only-upgrade <packagename>

```

but no luck.

Answer: 
### CLEAN SIMPLE STEPS (which I use) :

1. Uninstall previous version of node -  

`sudo apt remove node && sudo apt autoremove`
2. Go to <https://nodejs.org/en/> and download the latest version of
node.
3. Now open the terminal and change the directory where node is
downloaded and then run-  

`tar -xvf node-v12.16.2-linux-x64.tar.xz`
4. now run this in terminal -  

`nano ~/.bashrc`
5. and append it with the following –  

`export PATH=/path/to/node-js/bin:$PATH`  

Where,
**/path/to/node-js/** is to be replaced where you extracted node in step 3.`
6. run a last command `source ~/.bashrc`

That's it.  

Now you can check your node version by `node -v`
I tried the same list commands on my ubuntu 14.04 but it was still throwing an error.

Commands I executed were: 

```
sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs

```

and the error i was getting:

```
Invalid version 0.12.2
Line 299: curl not found in /bin/n

```

What I figured out was curl utility was not installed on my os. 

I executed command:

```
apt-get install curl

```

(use `sudo` as prefix if you are not `su`)

and then repeated the steps suggest in answer and it work ;)