I have tried various methods by which I can install the latest version of nodejs on my operating system but was unsuccessful. 

In the end it always ends up installing 
**version v.4.2.6**

When I run the commands below, it always shows an error as shared in the screenshots of my terminal.  

**Current release:**
sudo apt-get install curl python-software-properties
curl -sL <https://deb.nodesource.com/setup_11.x> | sudo -E bash -

**or LTS release:**  

sudo apt-get install curl python-software-properties
curl -sL <https://deb.nodesource.com/setup_10.x> | sudo -E bash -

// throws error
Version:  

[![enter image description here](https://i.stack.imgur.com/3BBSD.png)](https://i.stack.imgur.com/3BBSD.png)

Trying to execute node 11 script:  

[![enter image description here](https://i.stack.imgur.com/AsRcn.png)](https://i.stack.imgur.com/AsRcn.png)

o/p of the above script:   

[![enter image description here](https://i.stack.imgur.com/uokiJ.png)](https://i.stack.imgur.com/uokiJ.png)

Please guide me how can it be fixed. I have followed some of the other stackoverflow links but couldn't make it.

Thanks you for your help.