Agent Wranglers

STK-16Avoid

Leave Yarn Classic

Never start a project on Yarn 1, and move existing ones to npm or pnpm.

Review by

2027-04-30

How to do it

Yarn 1 fails the maintenance test. Its last release, 1.22.22, came out in March 2024, and it is frozen. It still had 5.3 million downloads in the week to 18 October 2026, mostly from old projects. Newer Yarn lines work very differently, so a move to npm costs about the same. Delete yarn.lock, run npm install once and commit the new package-lock.json. It fails Pick software that still ships releases.

Examples

Shell example

rm yarn.lock
npm install
git add package-lock.json

JavaScript example

import { existsSync } from 'node:fs';

export const usesYarnClassic = dir => existsSync(`${dir}/yarn.lock`) && !existsSync(`${dir}/.yarnrc.yml`);

How to check

The repository contains no yarn.lock with the Yarn 1 header # yarn lockfile v1, and no packageManager field names yarn@1.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/languages-and-runtimes/yarn-classic">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.