Install Yarn on Ubuntu 20.04 step-by-step instructions

Yarn Installation using the Ubuntu repository

  1. Install the yarnpkg package:
    $ sudo apt install yarnpkg
    
  2. Check the yarn version:
    $ yarnpkg --version
    1.22.4
    

Yarn Installation using the official Yarn repository

  1. Add Yarn repository by executing the below commands:
    $ sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    $ sudo sh -c "echo 'deb https://dl.yarnpkg.com/debian/ stable main' >> /etc/apt/sources.list"
    $ sudo apt update
    
  2. Install Yarn on your system. In case you have already installed Node.js on your Ubuntu 20.04 system you can avoid its installation by:
    $ sudo apt --no-install-recommends install yarn
    

    Otherwise, simply execute the below command:

    $ sudo apt install yarn
    

    which will install yarn as well as Node.js from the standard Ubuntu repository.

  3.  Check the yarn version:
    $ yarn --version
Was this answer helpful? 1 Users Found This Useful (1 Votes)