This guide contains multiple ways to install NodeJS, as well as how to install node package manager.
Note: only use one of these install methods, if you use multiple you'll end up with multiple node installations which is confusing and hard to debug
Note: this step is dependent on your operating system
sudo apt install npm -y
Note: i
and install
are interchangeable within npm
npm -g install n
n stable
n stable
node -v
n ls
n
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install node
nvm install node --reinstall-packages-from=node
node -v
nvm ls
nvm use 8.10.0
Note: not recommended, because this often installs an out-of-date version
sudo apt-get install nodejs
nodejs -v