install_yarn_latest_node.js_on_linux

This is an old revision of the document!


install yarn & latest node.js on linux

remove any nodejs versions installed via the packet manager of your os .. for example linux:

sudo apt remove --purge nodejs

install the latest version of nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d ' ",')/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

install latest version of nodejs with nvm

nvm install node 

add yarn repo (ubuntu, see yarn docs for other distros)

sudo apt install curl gnupg2 # in case you are on a fresh and minimalistic installation, i.e. in a Dockerfile :) 
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

install yarn without installing node.js from the repo..

sudo apt update && sudo apt install --no-install-recommends yarn
  • install_yarn_latest_node.js_on_linux.1605066683.txt.gz
  • Last modified: 11.11.2020 04:51
  • by Pascal Suter