Install and Setup Yarn

May 23, 2019

What is Yarn?

Package manager for JavaScript, aka npm replacement.

yarn vs npm

Yarn supposed to be faster, more secure and reliable.

NOTE: Why I use yarn? I was following VuePress documentation and it seems to prefer yarn, so I decide to give it a try. BTW, I am no expert or avid user of npm/yarn.

Can yarn and npm co-exist on same machine?

Yes, they seems to be independent (at the same time compatible) of each other. I don’t see any conflict so far.

NOTE: I didn’t try mixing yarn and npm in the same project.

Install yarn

curl -sS | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

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

NOTE: Yarn official installation guide.


npm install -g yarn

NOTE: Pros and Cons of installing yarn via npm.

Check yarn version

yarn --version

Yarn install packages

Install globally

yarn global add vuepres # OR npm install -g vuepress

Install locally

yarn add -D vuepress # OR npm install -D vuepress
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.