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.

2

5 Answers 5

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

Sign up to request clarification or add additional context in comments.

3 Comments

After uninstall, Restart system and then check node version, If showing there is some issue otherwise follow installation steps :)
You also need to run sudo bash nodesource_setup.sh after curl command before running install nodejs command. This worked for me:digitalocean.com/community/tutorials/…
The lastest is https://deb.nodesource.com/setup_20.x by Oct. 2023. However, from the developer page: github.com/nodesource/distributions "The installation scripts setup_XX.x are no longer supported and are not needed anymore, as the installation process is straightforward for any RPM and DEB distro. "
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

Comments

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.

Comments

0

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

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

Comments

0

You can install nvm for any version specific if you want to run and do your project.

  1. sudo apt install curl
  2. Next, run this:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

To activate it, either log out and log back in or run:

source ~/.bashrc

If NodeJS installed previously, then you can go to the specific project and in cmd run by the version of nodejs

nvm install version

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.