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.listsudo 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

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.