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: 
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 ;)
The selected [answer](https://askubuntu.com/a/480642/247771) did not work for me, I tried restarting terminal and PC but no success.

I have installed (as recommended in the docs) npm and node with node version manager. In this case, one can update node and npm simply with

```
nvm install stable

```

I explained [here](https://stackoverflow.com/a/59575266/2311074) how to switch to reinstall with node-verion-manager if you have installed npm/node with Node installer.