Ubuntu Install NPM, Upgrade NPM via NVM
sudo apt install npm
check node
node -v
check npm
npm -v
Upgrade NPM via NVM
update
sudo apt update
install curl (if needed)
sudo apt install curl
install NVM to your Ubuntu system:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
close and re-open your terminal session before using it.
Now that we have NVM installed, we can use it to install Node.js to Ubuntu
run the following command if you want to install the current release:
nvm install node
Alternatively, you can install the current LTS release of Node.js on Ubuntu by using the “--lts
” option:
nvm install --lts
or, specify version:
nvm install [VERSION]
If you have multiple versions of Node.js installed, you can switch between them by using “nvm use” followed by the version number:
nvm use [VERSION]
e.g.
nvm use 18
list the currently installed versions by using the following command:
nvm ls