Configure yarn version for Cloudflare page build

Emmanuel Gautier / May 18, 2023

1 min read

Cloudflare released Cloudflare page build v2 and introduce at the same time new language version and package managers versions as well. As I write this post, yarn has three major versions but most of the projects keep using the first version of yarn for different reasons.

When you try Cloudflare Page Build v2, if you don't specify the package manager version you are using, the Cloudflare system will choose the default installed one which is not the v1 for yarn.

The solution is simple and can be applied to other package managers. You can set the package manager and the version to use thanks to packageManager field in the package.json file. This field is introduced thanks to NodeJS Corepack project.

Here is an example if you want to keep using yarn v1 with Cloudflare Page build v2:

  "packageManager": "[email protected]"

packageManager field supports the following package managers according to the corepack code:

  • Npm
  • Yarn
  • Pnpm


If you're seeking solutions to a problem or need expert advice, I'm here to help! Don't hesitate to book a call with me for a consulting session. Let's discuss your situation and find the best solution together.

Share this post
Follow the RSS feed

Subscribe to the newsletter

Get the latest news about tech new articles and projects.