Yarn plug'n'play

npm is the default package manager for Node.js. Facebook has long been developing an alternative package management solution called Yarn . Yarn seems to be slowly disappearing from the Github readmes as the standard solution and the stats on the official site show that only a fraction of the packages are carried out by Yarn. Nevertheless, it is worth thinking outside the box.

Yarn is fully compatible with existing package.json files - so you can use both solutions for existing projects without any problems. The commands of the two solutions differ only marginally. Here is a comparison of the most important commands:

Initialize npm inityarn init
Updatenpm install -g npmyarn self-update
Installing the packagenpm install
--save [name]
yarn add [name]
Installing the packagenpm install
--save-dev [name]
yarn add
--dev [name]
Install package globallynpm install -g [name]yarn global add [name]
Install all packagesnpm installyarn install
Update all packagesnpm updateyarn upgrade
Uninstalling a packagenpm remove [name]yarn remove [name]

Yarn started with the aim of solving some of the weaknesses of npm. The most obvious difference is the higher performance: With incremental installations, multithreading and the latest killer feature Plug'n'Play (PNP) , performance increases dramatically. Plug'n'Play discards the idea of ​​a project-based node_modules folder, the number of files that can often grow to astronomical heights . More information can be found in the official plug'n'play whitepaper. We install eslint once with npm and then with yarn with the cache warmed up in each case to make the difference in speed (6x!) Clear:

npm 6.5.0
Yarn 1.12.3