What is Yarn?
Package manager for JavaScript, aka npm
replacement.
yarn vs npm
Yarn supposed to be faster, more secure and reliable.
- https://stackoverflow.com/questions/40396611/what-is-the-difference-between-brew-yarn-and-npm
- https://stackoverflow.com/questions/40027819/when-to-use-yarn-over-npm-what-are-the-differences/
- https://stackoverflow.com/questions/50278553/what-is-main-difference-between-yarn-and-npm/
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 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.listsudo apt-get update && sudo apt-get install yarn
NOTE: Yarn official installation guide.
or
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