2

my react project need updated nodejs. so how i can reinstall my node js to latest version in Ubuntu 16.04.

my current node version is

node -v
v6.0.0

my current npm version is

npm -v
3.8.6

ideally i want to reinstall my nodejs, node & npm to its newest version.

Vaibhav Shettar
  • 790
  • 2
  • 9
  • 20

4 Answers4

9

Uninstall NodeJS from Ubuntu

The command will remove the package but retain the configuration files.

sudo apt-get remove nodejs
sudo apt-get autoremove

To remove both the package and the configuration files run:

sudo apt-get purge nodejs
sudo apt-get autoremove

Install NodeJS on Ubuntu

Adding the NodeJS PPA to Ubuntu

sudo apt-get install software-properties-common
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

After successfully adding the NodeJS PPA, It’s time now to install NodeJS using the command below.

sudo apt-get install nodejs

Verfiying the version of NodeJS and NPM

node -v
npm -v

More Info: http://www.rscoder.com/2020/04/how-do-i-completely-uninstall-nodejs.html

Rahul Shukla
  • 7,365
  • 3
  • 15
  • 26
  • 1
    After uninstall, Restart system and then check node version, If showing there is some issue otherwise follow installation steps :) – Rahul Shukla Jun 26 '19 at 09:55
  • You also need to run `sudo bash nodesource_setup.sh` after curl command before running install nodejs command. This worked for me:https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04 – Urvah Shabbir Aug 26 '22 at 07:42
1

Uninstall NodeJS from Ubuntu

  • sudo apt-get remove nodejs
  • sudo apt-get update

Follow below link to install latest nodeJs in ubuntu

https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/

Ones you installed successfully, then if you want to check node version use below command.

node -v

Serg
  • 2,346
  • 3
  • 29
  • 38
Prakash Harvani
  • 1,007
  • 7
  • 18
0

Have you tried this?

sudo npm cache clean -f
sudo npm install -g n
sudo n 10.16.0

Or n latest to install latest version of node.

ThanhPhanLe
  • 1,315
  • 3
  • 14
  • 25
0

Follow below link to install and use other version of nodeJs in ubuntu

https://stackoverflow.com/a/59392965/9490901