add repository
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
If you need to install another version, for example 14.x, just change setup_12.x with setup_14.x
- Install Nodejs
sudo apt install nodejs
verify running node -v
NPM gets automatically installed .. you can skip this.
- Install npm
sudo apt install npm
verify running npm -v