//First, clear the npm cache:
npm cache clean -f
//Install n, Node’s version manager:
npm install -g n
//With the n module installed, you can use it to:
Install the latest stable version: n stable
Install the latest release: n latest
npm install -g npm //latest stable version of npm
npm install -g node@v16.18 //latest stable version of node
npm update npm -g
//check node version
>node -v
// let's install a program called n that will let us easily switch
//between Node versions.
>npm install -g n
//Upgrading to the latest stable version
>n stable
//Changing to a specific version
>n 10.16.0
npm cache clean -f
npm install -g n
sudo n stable
sudo n latest
> Go to nodejs.org
> Download and install the latest version
"I don't like this answer but I promise you this is the way"
#linux
sudo npm install n -g
sudo n stable
#windows
#install the .msi from https://nodejs.org/en/download/
sudo npm install -g n
npm install -g n
sudo n stable
Update Node.js
sudo npm cache clean -f
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs
# With NVM
yay -S nvm
echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
exec $SHELL
nvm ls-remote
nvm install v18.1.0
brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local
brew link --overwrite node
brew postinstall node
Go to the node.js website, download the latest one for your
system and install it. Everything else will be taken care of automatically.
you can run node -v to check if it worked and the latest version will be installed.
sudo n 0.8.20