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": "yarn@1.22.19"
}
packageManager field supports the following package managers according to the corepack code:
- Npm
- Yarn
- Pnpm
Consulting
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.
Related Posts
How to pass npm flag with Cloudflare workers during install
I have encountered an error forcing me to use the `legacy-peer-deps` flag with npm. But it is not so simple with Cloudflare workers because install command is not configurable easily. In this blog post, we'll look how to pass npm flag with Cloudflare workers.
How to pass npm flag with Cloudflare workers during install
I have encountered an error forcing me to use the `legacy-peer-deps` flag with npm. But it is not so simple with Cloudflare workers because install command is not configurable easily. In this blog post, we'll look how to pass npm flag with Cloudflare workers.
Read Package.json file from Node.JS module
When you write a program you may want to read the content of the package.json file like what is the current package version. Here is one very simple way to read the content of this file.
Featured Posts
Introducing new blog about OAuth, OpenID Connect, and IAM Solutions
I'm excited to announce the launch of a new blog named CerberAuth, where I'll be exploring the world of OAuth, OpenID Connect, and IAM solutions for modern security.
How to deal with Docker Hub rate limit on AWS
Since 2020, DockerHub has been limited to only 200 container image pull requests per six hours. This article will help you to deal with this limitation on AWS.
How to enable Python type checking in VSCode
Python now has support for type hints. In this article, we will see how to enable better IntelliSense and type checking analysis in VSCode.