Introducing Yarn: Facebook’s Latest JS Package Manager

Most frontend developers already know about npm which is the Node-powered package manager for JavaScript libraries, frameworks and plugins. This is the most widely used package manager by web developers, but Facebook has come up with a brand new package manager named Yarn which is quickly becoming npm’s hot rival.

With Yarn you can still pull items from the npm repository, but you can also pull from other repos and manage your own custom dependencies installed across many different machines.

yarn homepage

The biggest benefit of Yarn is consistency for different versions of scripts and management for different machines.

Users who rely on npm may have the latest version of jQuery on their laptop, but might switch over to their desktop and be running a slightly outdated version. This can typically be managed with an update call but Yarn might be easier.

Ultimately developers use package managers to install resources called packages from a universal repository. These packages can be libraries, frameworks, or any type of pre-packaged code.

When it comes to auto-updating packages, Yarn aims to make this process broader, easier and much more secure. These ideas are still coming out of Facebook’s dev team but Yarn already offers some incredible benefits:

  • Access to npm, bower, and other custom repos
  • Dependencies can be installed across multiple machines
  • Optimum performance based on download speeds
  • Package caching, so you can download again without Internet

On the Yarn GitHub page you’ll find installation instructions for local websites or live production sites.

yarn package manager logo

If you’re brand new to Yarn and want to go for a test run, do check out the usage guide on the official website. This is one of the simplest package managers to jump into, and if you already have some experience using npm then you’ll feel right at home with Yarn.

And since this is still a fairly new project, I expect a lot of updates from Facebook in the coming months.