Home > Mobile >  Updating node version
Updating node version

Time:11-22

I have updated Node js by following these steps:

sudo npm install -g n
sudo n stable
sudo n latest

However when I check the version with:

node -v

or

nodejs -v

I get the old/current version which is v10.19.0

any idea why this is happening?

CodePudding user response:

Consider using nvm and specifying the version you would like to use:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
nvm install 13.10.1

You can try clearing you cache if you want to edit your global node version: sudo npm cache clean -f

CodePudding user response:

So I figured out how to to upgrade to the latest version of node js. First you need to remove the older version of node with this syntax:

sudo apt-get purge --auto-remove nodejs

Install npm with:

sudo apt install npm

For me it already installed the latest version of node js, however if it did not work for you continue by installing node with these syntaxes:

npm install n -g
n stable
sudo n latest

Then check your node version by running node -v

  • Related