Install NodeJS and Yarn

Published: Aug. 19, 2022

NodeJS

Install the latest LTS version of NodeJS (v16.x)

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

Setting a folder for global installations,

# create new folder
mkdir ~/.npm-global

# configure npm to use the folder
npm config set prefix '~/.npm-global'

Finally, add the following line to your ~/.zshrc file.

path+=('$HOME/.npm-global/bin')

Reload Zsh config for changes to take effect.

source ~/.zshrc

Yarn

Install yarn via NPM

npm install --global yarn

# check version
yarn --version

Last updated: Aug. 19, 2022, 3:54 p.m.