Nodejs and NPM
TL;DR
version=v0.39.7
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$version/install.sh | bash
source ~/.bashrc
nvm install 20.0
NVM Install
Install nvm
Latest version of NVM
version=v0.39.7
curl -O https://raw.githubusercontent.com/nvm-sh/nvm/$version/install.sh
bash install.sh
rm -f install.sh
vi ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source .bashrc
Check version
nvm --version
Install node using nvm
List available versions
nvm ls
nvm ls-remote
Install Node and NPM
nvm install node
nvm install stable
nvm install --lts
nvm install 20.0
Use specific version
nvm alias default 20.0
nvm use default
nvm use --lts
nvm use 20.0
nvm use node
Uninstall node
Uninstall Node
nvm uninstall <version>
Uninstall nvm
rm -rf .nvm
Remove nvm entry from login file
vi .bashrc
Package Install
NodeSource install
version=lts # 20 18
curl -fsSL "https://deb.nodesource.com/setup_${version}.x" -o nodesource_setup.sh
sudo bash nodesource_setup.sh
Install nodejs
sudo apt install -y nodejs
Hold apt package
sudo apt-mark hold nodejs npm
Uninstall nodejs
sudo apt remove -y nodejs