Install nodejs 12
cd ~
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejsYou may also need development tools to build native addons:
sudo apt-get install gcc g++ makeTo install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarnAn alternative to installing Node.js with apt is to use a tool called nvm, which stands for “Node.js Version Manager”. Rather than working at the operating system level, nvm works at the level of an independent directory within your home directory. This means that you can install multiple self-contained versions of Node.js without affecting the entire system.
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm ls-remote
nvm install 12.18.3
nvm use 12.18.3If you have multiple Node.js versions, you can see what is installed by typing:
nvm lsIf you wish to default one of the versions, type:
nvm alias default 12.18.3This version will be automatically selected when a new session spawns. You can also reference it by the alias like this:
nvm use default