install_yarn_latest_node.js_on_linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
install_yarn_latest_node.js_on_linux [11.11.2020 04:51] – created Pascal Suterinstall_yarn_latest_node.js_on_linux [13.11.2020 23:16] (current) Pascal Suter
Line 1: Line 1:
 ====== install yarn & latest node.js on linux ====== ====== install yarn & latest node.js on linux ======
 +run all these steps as root to install nvm and node globally for all users. if you want to install node on a per-user basis, this guide is not for you, you need to modify the steps. 
 +
 remove any nodejs versions installed via the packet manager of your os .. for example linux:  remove any nodejs versions installed via the packet manager of your os .. for example linux: 
-  sudo apt remove --purge nodejs+  apt remove --purge nodejs
  
-install the latest version of nvm  +install the latest version of nvm. note, this will install nvm globally for all users.  
-  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 +<code> 
-  export NVM_DIR="$HOME/.nvm" +export XDG_CONFIG_HOME="/opt" 
-  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads 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 
-  [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion+echo 'export NVM_DIR="'$XDG_CONFIG_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' > /etc/profile.d/nvm.sh 
 +source /etc/profile.d/nvm.sh 
 +</code>
  
 install latest version of nodejs with nvm  install latest version of nodejs with nvm 
Line 13: Line 19:
  
 add yarn repo (ubuntu, see [[https://classic.yarnpkg.com/en/docs/install|yarn docs]] for other distros) add yarn repo (ubuntu, see [[https://classic.yarnpkg.com/en/docs/install|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 :)  +  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 - +  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 
-  echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list+  echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
  
 install yarn without installing node.js from the repo..  install yarn without installing node.js from the repo.. 
-  sudo apt update && sudo apt install --no-install-recommends yarn+  apt update && 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