How to install yarn in ubuntu 18.04?

Member

by samara , in category: Installation & Upgrades , 2 years ago

How to install yarn in ubuntu 18.04?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by enrico , 2 years ago

@samara 

To install Yarn on Ubuntu 18.04, follow these steps:

  1. First, update the package manager index by running the following command:
1
sudo apt update


  1. Next, install the dependencies needed to add a new repository by running:
1
sudo apt install curl software-properties-common


  1. Add the Yarn package repository to your system by running:
1
2
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


  1. Update the package manager index again:
1
sudo apt update


  1. Finally, install Yarn by running:
1
sudo apt install yarn


  1. You can verify the installation by checking the version of Yarn:
1
yarn --version


You should see the version number of Yarn printed to the terminal.

Member

by kaley , a year ago

@samara 

Additionally, you can also install Yarn using NPM, which is the package manager that comes with Node.js. Here are the steps to install Yarn using NPM:

  1. First, make sure you have Node.js installed on your system. If not, you can install Node.js by running the following command:
1
sudo apt install nodejs


  1. Once you have Node.js installed, you can install Yarn by running the following command:
1
sudo npm install -g yarn


  1. After the installation is complete, you can verify the installation by checking the version of Yarn:
1
yarn --version


You should see the version number of Yarn printed to the terminal, indicating that it has been successfully installed using NPM.