Having a pnpm-workspace is breaking the deploy on Cloudflare

Hello, On multiple project, as soon as I approve some build (let's say prisma) by running pnpm approve-builds it generates a pnpm-workspace in addition to my package.json automatically. As soon as this file is present, my Cloudflare Worker stops deploying
02:18:34.484 Initializing build environment...
02:18:41.470 Success: Finished initializing build environment
02:18:42.380 Cloning repository...
02:18:46.621 Detected the following tools from environment: pnpm@10.11.1, nodejs@22.16.0
02:18:46.623 Restoring from dependencies cache
02:18:46.624 Restoring from build output cache
02:18:47.442 Installing project dependencies: pnpm install --frozen-lockfile
02:18:48.833  ERROR  packages field missing or empty
02:18:48.833 For help, run: pnpm help install
02:18:48.844 Failed: error occurred while installing tools or dependencies
02:18:34.484 Initializing build environment...
02:18:41.470 Success: Finished initializing build environment
02:18:42.380 Cloning repository...
02:18:46.621 Detected the following tools from environment: pnpm@10.11.1, nodejs@22.16.0
02:18:46.623 Restoring from dependencies cache
02:18:46.624 Restoring from build output cache
02:18:47.442 Installing project dependencies: pnpm install --frozen-lockfile
02:18:48.833  ERROR  packages field missing or empty
02:18:48.833 For help, run: pnpm help install
02:18:48.844 Failed: error occurred while installing tools or dependencies
why ?
1 Reply
Tristan
TristanOP5w ago
the pnpm-workspace.yaml file:
onlyBuiltDependencies:
- '@prisma/client'
- '@prisma/engines'
- prisma
onlyBuiltDependencies:
- '@prisma/client'
- '@prisma/engines'
- prisma
LLM answer, did the trick :
Simply add a packages: field to your pnpm-workspace.yaml file. Since you're not using a monorepo, just add the root: I've already made the fix - I added packages: ['.'] at the beginning of the file. This tells pnpm that your main package is at the project root. Now your Cloudflare Pages deployment should work correctly. The pnpm-workspace.yaml file is valid and pnpm won't complain about the missing packages field anymore. Important note: Each time you run pnpm approve-builds, it may recreate this file without the packages: field. You'll then need to add it back manually. This is a known bug in pnpm v10 that hasn't been fixed yet.

Did you find this page helpful?