🧶

Yarn

Yarn is a JavaScript package manager originally released by Facebook in 2016 and now maintained by the open-source community, free to use under an MIT-style license. It ranks #11 among dev tools in usage surveys at roughly 21.1% share. It was created to fix early npm's slow, non-deterministic installs — Yarn introduced a lockfile that guarantees the exact same dependency tree on every machine, plus faster, parallelized installs, and remains a popular npm alternative across JavaScript projects.

Quick facts
Type: JavaScript/Node.js package manager
Made by: Originally Facebook (Meta); now an independent open-source project
License: Free / open-source (BSD/MIT)
Platforms/Hosting: Cross-platform (Windows, macOS, Linux), runs on Node.js
Primary use case: Installing, versioning, and locking JavaScript/TypeScript project dependencies as an alternative to npm
Jump to: ExampleGetting startedBest for

Example

Yarn commands mirror npm's workflow closely — add a dependency, then install the full tree from the lockfile.

# add a dependency to package.json + yarn.lock
yarn add react react-dom

# add a dev-only dependency
yarn add --dev typescript

# install everything from an existing yarn.lock (e.g. in CI)
yarn install --frozen-lockfile

# run a script defined in package.json
yarn run build

Getting started

Yarn installs via npm itself (or Corepack, which ships with modern Node) so it can manage the very ecosystem it replaces.

# install Yarn globally via npm
npm install --global yarn

# or, with Node 16.10+, enable Corepack (no separate install needed)
corepack enable

# verify
yarn --version
Best for: JavaScript/TypeScript teams that want strictly reproducible installs across machines and CI, or that are already using Yarn's workspaces feature to manage a monorepo of related packages.