We’ve used the npm client successfully at Facebook for years, but as the size of our codebase and the number of engineers grew, we ran into problems with consistency, security, and performance. After trying to solve for each issue as it came up, we set out to build a new solution to help us manage our dependencies more reliably. The product of that work is called Yarn — a fast, reliable, and secure alternative npm client.
We’re pleased to announce the open source release of Yarn, a collaboration with Exponent, Google, and Tilde. With Yarn, engineers still have access to the npm registry, but can install packages more quickly and manage dependencies consistently across machines or in secure offline environments. Yarn enables engineers to move faster and with confidence when using shared code so they can focus on what matters — building new products and features.
You can try
yarn right now:
npm install -g yarn
The yarn CLI replaces npm in your development workflow, either with a matching command or a new, similar command:
npm install → yarn
With no arguments, the yarn command will read your package.json, fetch packages from the npm registry, and populate your node_modules folder. It is equivalent to running npm install.
npm install --save <name>→
yarn add <name>
They’ve removed the “invisible dependency” behavior of
npm install <name> and split the command. Running
yarn add <name> is equivalent to running
npm install --save <name>.