Quick node and npm installation using nvm on Debian
Below is a bunch of CLI commands for installing Node using nvm command. NVM is a node version manager, basically a BASH script, which makes it easy to install and manage Node versions on an operating system like Debian GNU/Linux. Debian has a package called nodejs which contains Node and npm, but those are older versions and you won't get the flexibility of switching Node versions whatever way you want with it, so it is probably better to use nvm.
Run these commands without sudo or switching to root user.
cd curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh -o install_nvm.sh bash install_nvm.sh source ~/.profile nvm ls-remote | grep "Latest LTS"
As ouput you will get something similar to this:
. . . v4.9.1 (Latest LTS: Argon) v6.17.1 (Latest LTS: Boron) v8.17.0 (Latest LTS: Carbon) v10.24.1 (Latest LTS: Dubnium) v12.22.8 (Latest LTS: Erbium) v14.18.2 (Latest LTS: Fermium) v16.13.1 (Latest LTS: Gallium)
Now to run the lates long term suppored version, run:
nvm install 16.13.1
That's it. You should be able access both node and npm command on the command line now. Enjoy!
Author, Copyright and citation
Author of the this article - Sylwester Wojnowski - is a sWWW web developer. He has been writing computer code for the websites and web applications since 1998.
©Copyright, 2022 Sylwester Wojnowski. This article may not be reproduced or published as a whole or in parts without permission from the author. If you share it, please give author credit and do not remove embedded links.
Computer code, if present in the article, is excluded from the above and licensed under GPLv3.
Cite this article as:
Wojnowski, Sylwester. "Quick node and npm installation using nvm on Debian." From sWWW - Code For The Web . https://wojnowski.net.pl//main/index/quick-node-and-npm-installation-using-nvm-on-debian