This article was published on October 12, 2016

Facebook launches Yarn, a JavaScript package manager built for speed


Facebook launches Yarn, a JavaScript package manager built for speed Image by: Facebook

Facebook has launched Yarn, an open source JavaScript package manager that promises faster and more reliable installs than the massively popular npm. The company says its new creation is capable of reducing install times from several minutes to just seconds in some cases – depending on the size of the packages you’re working with, of course.

Yarn is compatible with the npm registry, but differs in its approach to installing packages; it uses lockfiles and a deterministic installation algorithm.

This allows it to maintain the same structure of node_modules directories – which house dependencies – for all users involved in a project, and help reduce bugs that are difficult to trace and replicate on multiple machines.

Yarn also aims to ensure quicker and more reliable installs by caching every package it downloads and by parallelizing operations. It also allows for installing packages without an internet connection, provided you’ve installed them at least once before.

In addition, Yarn promises compatibility with both npm and Bower workflows, and lets you restrict licenses of installed modules.

Facebook noted that it used npm extensively for numerous projects, but had trouble scaling it for internal use as it posed issues with performance and security. It teamed up with engineers from Exponent, Google, and Tilde to build and test Yarn on major JavaScript frameworks, so it works for as large a base of developers as possible.

The team at npm noted in a blog post that it’s happy to welcome Yarn into the fold of open source npm clients. It added that Yarn “seems to work great with public packages,” but it doesn’t yet work with private packages; the developers behind Yarn are working to fix the issue.

Yarn is the latest open source project from Facebook this year; through 2016, it’s released a code library for building AI botsa tool for getting started easily with its React JavaScript librarya wireless access platform for delivering internet access in low-connectivity areas and even a 360-degree camera setup. Its frequent contributions saw it reach #2 on GitHub’s list of organizations with the most open source contributors, right after Microsoft.

You can install Yarn from its new site and find its source code in this GitHub repository.

Get the TNW newsletter

Get the most important tech news in your inbox each week.

Also tagged with