Yarn 4 support

It would be really great to have yarn 4 support in Vercel. Currently our project only needs it for static builds, but ideally it would be fully supported. Yarn is a very popular package manager, and yarn 4 has been out for nearly a year.

1 Like

Hey, @robinclowers! Welcome to the Vercel Community :smile:

Thanks for the feedback! I’ve shared it with our team internally and will loop back with any comments.

Additionally, Storybook no longer “officially” supports yarn 1 (classic) as of version 8 of Storybook. So it would be nice if Vercel supported a version of yarn > v1

1 Like

Thanks, @russholio!

I’ve shared this internally.

Thanks for pointing this, @robinclowers!

It would be great to have this soon

@robinclowers They’ve released corepack support, which makes it possible to use any package manager, check it out: Configuring a Build

1 Like

Unfortunately even with corepack, yarn 4 still doesn’t work: Error: Dynamic require of "util" is not supported, you are still subject to the list of supported package managers: Package Managers.

1 Like

We would appreciate Yarn 4 support as well. In our case, we were expecting to be able to use the workspace protocol. We will try corepack, but the experimental warnings in the docs and @robinclowers experience are not very encouraging.

1 Like

Not understanding why Vercel would not have support for yarn 4.x given that 1.x is supported. Was there product team thinking like “maybe yarn 2.x+ won’t be adopted?”

It’s the equivalent of, “we support rotary phones but not push buttons.”

There’s a large project I would bring over from Netlify if Vercel had yarn 4.x support. I’m not able/willing to throw away the yarn berry features we use.

If you are seeing Error: Dynamic require of "util" is not supported with Yarn 4, there are currently two work arounds to consider:

  1. Remove "type": "module" from the project’s package.json
  2. Install yarn into the project instead of using corepack with yarn set version [desired-version] --yarn-path

Currently our project only needs it for static builds, but ideally it would be fully supported.

Yarn should now work for Serverless Functions and SSR.

Please let us know if you run into any other issues! While pnpm is our main focus, we are trying to improve Yarn support where we can.

3 Likes

Yarn 2+ dependency caching is now supported!

For Yarn 4, make sure you enable Corepack as recommended by Yarn

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.