In this article you will learn how to install Yarn, the JavaScript package manager on Ubuntu 20.04 Focal Fossa Linux.
In this tutorial you will learn:
- How to add Yarn repository
- How to install Yarn
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa |
Software | Yarn |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Install Yarn on Ubuntu 20.04 step by step instructions
Yarn Installation using the Ubuntu repository
- Install the
yarnpkg
package:$ sudo apt install yarnpkg
- Check yarn version:
$ yarnpkg --version 1.22.4
Yarn Installation using the official Yarn repository
- 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
- 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 executing the below command:
$ sudo apt install yarn
which will install
yarn
as well as Node.js from the standard Ubuntu repository. - Check the
yarn
version:$ yarn --version