82

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

Aurora0001
  • 13,139
  • 5
  • 50
  • 53
Jose
  • 1,779
  • 4
  • 26
  • 50

6 Answers6

174

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

Shaig Khaligli
  • 4,955
  • 5
  • 22
  • 32
  • 2
    Thank you, I misunderstood and thought that I did not have to take that step with 16.04. – Jose Mar 05 '17 at 10:23
  • 2
    Note: Ubuntu 17.04 comes with cmdtest installed by default. If you’re getting errors from installing yarn, you may want to run sudo apt remove cmdtest first. Refer to this for more information. – vulcan_hacker Jul 25 '17 at 03:37
  • @vulcan_hacker yes and Node.js is already installed. I though of re-installing it. It always gives me issues, Fact is Node.js supports Linux Mint 17.2 not 18. I did follow all those instruction, still yarn does not work – Fabrizio Bertoglio Aug 04 '17 at 04:12
  • This installation will install default node version from it's apt repository, which will break existing nodejs installation, if it's installed in some other way, like nvm, for example – Aleksandar Pavić Jan 21 '19 at 10:26
  • From my perspective it would be nice if Yarn were part of the ubuntu distribution – ffejrekaburb Mar 08 '19 at 11:27
  • @ffejrekaburb maybe one day it will be – Shaig Khaligli Mar 18 '19 at 22:07
47

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

ow3n
  • 5,974
  • 4
  • 53
  • 51
5

See on Installation | Yarn | Linux tab

There are instructions for several linux distributions

simhumileco
  • 31,877
  • 16
  • 137
  • 115
1

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.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
themefield
  • 3,847
  • 30
  • 32
1

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 &&)

0

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

Alex Varghese
  • 2,000
  • 16
  • 17