3

I am trying to install node.js version10 on my ubuntu 18.04 but it is always installing version 8.10. I have tried different links. I have tried the following commands:

$ sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

Installing the NodeSource Node.js 10.x repo...

Populating apt-get cache...

@lc2530hz:~$ sudo apt install nodejs 

Reading package lists... Done Building dependency tree Reading state information... Done nodejs is already the newest version (8.10.0~dfsg-2ubuntu0.4). The following packages were automatically installed and are no longer required: gyp libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev libuv1-dev libwireshark11 libwiretap8 libwscodecs2 libwsutil9 Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 259 not upgraded.

But I am always getting version 8.10:

lc2530hz:~$ node -v

v8.10.0 @lc2530hz:~$

Somebody please guide. Zulfi.

user2994783
  • 225
  • 3
  • 6
  • 16

1 Answers1

3

I am using nvm to switch between nodejs versions.
https://github.com/nvm-sh/nvm
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
restart terminal
Install node 10.x:
nvm install 10
Switch to node 10.x:
nvm use 10
Check node version:
node -v