---
title: Does Vercel Support Yarn? (Versions 2, 3, and 4)
description: Vercel supports Yarn 1, 2, 3, and 4. Learn which version your build uses by default, and how to pin Yarn 4 with Corepack or a committed release.
url: /kb/guide/does-vercel-support-yarn-4
canonical_url: "https://vercel.com/kb/guide/does-vercel-support-yarn-4"
published: 2025-11-03
last_updated: 2026-09-03
authors: Austin Merrick
related:
  - /docs/deployments/logs
  - /docs/package-managers
  - /docs/builds/configure-a-build
  - /docs/environment-variables
  - /docs/deployments/troubleshoot-a-build
  - /docs/monorepos/monorepo-faq
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Yarn 2+ dependency caching now supported](https://vercel.com/changelog/yarn-2-dependency-caching-now-supported?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related)
- [How Vercel builds your application](https://vercel.com/docs/fundamentals/builds?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Learn how Vercel transforms your source code into optimized assets ready to serve globally.
- [Builds](https://vercel.com/docs/builds?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Understand how the build step works when creating a Vercel Deployment.
- [Deploying to Vercel](https://vercel.com/docs/deployments?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Create, verify, and manage preview and production deployments on Vercel from Git, Vercel CLI, or the REST API.
- [Getting started with Vercel](https://vercel.com/docs/getting-started-with-vercel?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Install the Vercel CLI, add the Vercel Plugin or agent skills, and deploy your first project.
- [Frameworks on Vercel](https://vercel.com/docs/frameworks?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Vercel supports a wide range of the most popular frameworks, optimizing how your application builds and runs no matter w
- [Does Vercel support Yarn 2?](https://vercel.com/kb/guide/does-vercel-support-yarn-2?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Information on Vercel's support for Yarn 2.
- [Does Vercel support Yarn 3?](https://vercel.com/kb/guide/does-vercel-support-yarn-3?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Information on Vercel's support for Yarn 3.
- [Conditional Build Commands: Environment, Branch, and Custom Workflows](https://vercel.com/kb/guide/dynamic-build-commands?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Run a different Vercel build command for each environment or Git branch using a shell script, vercel.json, or vercel.ts,
- [Deploying a Monorepo Using Yarn Workspaces to Vercel](https://vercel.com/kb/guide/deploying-yarn-monorepos-to-vercel?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — In this guide, you will deploy a monorepo that includes two frontend applications and one shared library with Yarn works
- [Migrate a TanStack Start app from Cloudflare to Vercel](https://vercel.com/kb/guide/migrate-a-tanstack-start-app-from-cloudflare-to-vercel?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=related) — Move your TanStack Start app off Cloudflare Workers and onto Vercel Functions, where Fluid compute scales it automatical

Full cross-link map for this page: [/kb/guide/does-vercel-support-yarn-4.graph.md](/kb/guide/does-vercel-support-yarn-4.graph.md?from=related&source_path=%2Fkb%2Fguide%2Fdoes-vercel-support-yarn-4&source_site=vercel-kb&relationship=graph)
<!-- /docsgraph:related -->


## Does Vercel support Yarn?

Yes. Vercel supports [Yarn Classic](https://classic.yarnpkg.com/) (1.x) and the [Berry line](https://yarnpkg.com/), including Yarn 2, Yarn 3, and Yarn 4. A `yarn.lock` file on its own tells Vercel to install with Yarn 1, so a project on a newer release has to declare its version through Corepack or a committed Yarn binary.

## Which Yarn versions does Vercel support?

All four Yarn releases run on Vercel, and what you configure depends on which one you're on:

| Yarn version     | Latest release | How Vercel runs it                                                        |
| ---------------- | -------------- | ------------------------------------------------------------------------- |
| Yarn 1 (Classic) | 1.22.22        | Selected automatically when `yarn.lock` is present. Nothing to configure. |
| Yarn 2 (Berry)   | 2.4.3          | Corepack, or a release committed to `.yarn/releases`.                     |
| Yarn 3 (Berry)   | 3.8.7          | Corepack, or a release committed to `.yarn/releases`.                     |
| Yarn 4 (Berry)   | 4.18.0         | Corepack, or a release committed to `.yarn/releases`.                     |

Vercel detects your package manager from the lock file in your repository. For npm and pnpm, it reads a `lockfileVersion` field to pick the version, and `yarn.lock` carries no equivalent, which is why a Yarn project defaults to Yarn 1.

Yarn 2 stopped at 2.4.3, and Yarn 3's last release was 3.8.7 in December 2024, so new projects should target Yarn 4.

## How to use Yarn 4 on Vercel

Two routes get Yarn 4 running on a Vercel build. Corepack reads the version from your `package.json`, and the other stores the Yarn release in your repository.

### Enable Corepack for your project

Corepack ships with Node.js 16 and later, and it selects the package manager version from the `packageManager` field in `package.json`. On Vercel, an environment variable turns it on.

To enable Corepack:

1. Run `yarn set version 4.18.0` in your project root to write the `packageManager` field.
   
2. Commit the updated `package.json`.
   
3. In the Vercel dashboard, open your project and select **Settings**, then **Environment Variables**.
   
4. Add a variable named `ENABLE_EXPERIMENTAL_COREPACK` with the value `1`.
   
5. Redeploy the project.
   

The field Corepack reads on each build looks like this:

```json
{
  "packageManager": "yarn@4.18.0"
}
```

Pin an exact version rather than a range, so every build and every developer machine runs the same Yarn release. Corepack is experimental in Node.js, and its behavior can change between Node.js releases.

### Commit a Yarn release to `.yarn/releases`

The second route keeps the Yarn binary in your repository. Yarn Classic reads the `yarnPath` setting from `.yarnrc.yml` and hands the install to the release it points at, which is how a build reaches Yarn 4 without Corepack.

Run this in your project root:

```bash
yarn set version 4.18.0 --yarn-path
```

The command downloads the release into `.yarn/releases` and writes the path into `.yarnrc.yml`:

```yaml
yarnPath: .yarn/releases/yarn-4.18.0.cjs
```

Commit both the release file and `.yarnrc.yml`. If the binary is missing from the repository, the install fails with an error reporting that the `yarn-path` location doesn't exist.

### Keep the cache in the repository for zero-installs

Yarn 4 stores its cache globally by default, so a zero-install setup needs `enableGlobalCache` set to `false` in `.yarnrc.yml`. That writes package archives into `.yarn/cache` inside the project, where you can commit them alongside your code. A Vercel build clones your repository before the install step, so a committed cache is on disk by the time `yarn install` runs.

## How Vercel handles Yarn 2 and Yarn 3

Yarn 2 and Yarn 3 use the same two routes as Yarn 4. Enable Corepack and pin the version in `packageManager`, or run `yarn set version 3.8.7 --yarn-path` (or `yarn set version 2.4.3 --yarn-path`) to commit a release into `.yarn/releases`.

Plug'n'Play has been Yarn's default install mode since Yarn 2, so a Berry project installs without a `node_modules` directory unless it opts out. Some build tooling still expects that directory to exist.

To install into `node_modules` instead, set the linker in `.yarnrc.yml`:

```yaml
nodeLinker: node-modules
```

Yarn's [migration guide](https://yarnpkg.com/migration/guide) covers the rest of the move from Yarn Classic to a Berry release, including lockfile and configuration changes that apply before your first deployment.

## How to troubleshoot Yarn version detection on Vercel

When a build installs with the wrong Yarn version, the repository and the build environment disagree about which version to use.

Check these in order:

- **Corepack environment variable:** Confirm `ENABLE_EXPERIMENTAL_COREPACK` is set to `1` on the environment you deployed to, since Preview and Production are scoped separately.
  
- **The** `**packageManager**` **field:** Confirm it's committed and pins a full version, such as `yarn@4.18.0`.
  
- **The committed release:** Confirm `.yarn/releases` and `.yarnrc.yml` are both in the repository, and that `.gitignore` isn't excluding `.yarn`.
  
- **The install command:** An **Override** in **Build & Development Settings**, or an `installCommand` in `vercel.json`, replaces the detected install command.
  

Your [build logs](https://vercel.com/docs/deployments/logs) name the package manager and version used for the install, so you can confirm which setting won.

## Next steps

With the Yarn version pinned in your repository, the project is ready to deploy. [Start a new Vercel project](https://vercel.com/new) to import it, or [browse the templates](https://vercel.com/templates) for a framework-ready starting point.

## Related resources

- [Package managers](https://vercel.com/docs/package-managers)
  
- [Configuring a build](https://vercel.com/docs/builds/configure-a-build)
  
- [Environment variables](https://vercel.com/docs/environment-variables)
  
- [Troubleshoot a build](https://vercel.com/docs/deployments/troubleshoot-a-build)
  
- [Monorepos FAQ](https://vercel.com/docs/monorepos/monorepo-faq)