Install Yarn Ubuntu 16.04 (Linux Mint 18.1)

node.jsUbuntu 16.04Yarnpkg

node.js Problem Overview


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

node.js Solutions


Solution 1 - node.js

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

Solution 2 - node.js

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

Solution 3 - node.js

See on Installation | Yarn | Linux tab

There are instructions for several linux distributions

Solution 4 - node.js

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.

Solution 5 - node.js

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

Solution 6 - node.js

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoseView Question on Stackoverflow
Solution 1 - node.jsShaig KhaligliView Answer on Stackoverflow
Solution 2 - node.jsow3nView Answer on Stackoverflow
Solution 3 - node.jssimhumilecoView Answer on Stackoverflow
Solution 4 - node.jsthemefieldView Answer on Stackoverflow
Solution 5 - node.jsclassnotes101View Answer on Stackoverflow
Solution 6 - node.jsAlex VargheseView Answer on Stackoverflow