77
votes

I have a new installation of Linux Mint 18.1 with Ubuntu 16.04. I have installed Node 6.10.0.

When doing the command that indicates the documentation of Yarn:

sudo apt-get update && sudo apt-get install yarn

It says "could not find yarn package"

I must do something else, because in the documentation I do not see anything about it.

Thank you.

enter image description here

6

6 Answers

163
votes

On Ubuntu Linux, you can install Yarn via Debian package repository. You will first need to configure the repository:

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

Then you can simply:

sudo apt-get update && sudo apt-get install yarn

More information here

42
votes

I was unable to install Yarn on Ubuntu 16.04 using the accepted answer but found it easy with npm:

npm install -g yarn

Then check install / version with

yarn --version

5
votes

See on Installation | Yarn | Linux tab

There are instructions for several linux distributions

1
votes

Here are more details about the official install instruction.

  1. apt-key command gets the public authentication key for software integration check.

  2. deb https://dl.yarnpkg.com/debian/ stable main is the Ubuntu repository containing yarn. Look at OP's screenshot, the top 10 lines list existing repositories to search for packages, but there is no yarn's one. So we need to add the repository by creating file /etc/apt/sources.list.d/yarn.list.

  3. After the above two steps, issue apt/apt-get command to add yarn like usual Ubuntu packages.

0
votes

In Ubuntu or Linux you can install yarn using terminal ,But before installing You will first need to configure the repository, for that run the below commands

sudo apt install curl

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 

after setting up the repository you can simply install yarn using below command

sudo apt-get update && sudo apt-get install yarn

Once the installation gets completed you can check the version using following command

yarn --version

for more details go to yarn documentation

0
votes

Be careful when using &&. I get the same error when running sudo apt-get update, which prevents terminal from running sudo apt-get install yarn. I was able to successfully install yarn on Ubuntu 16.04 by running these commands separately (without using &&)