Worker Builds w/ PNPM failing `postinstall` for esbuild, workerd, @parcel/watcher, and sharp
Off the bat—
sharp is only used in a script during build; it's never imported from worker code.
Having an issue where Worker Builds is failing most of the postinstall scripts in my project's dependencies. The specific failures are for:
- esbuild (JS script; appears to ensure the correct binary is installed), which is depended on by drizzle-kit
- workerd (nearly identical script to esbuild), which is depended on by wrangler (via its dependency on miniflare)
- @parcel/watcher (JS script; builds from source), depended on by sass, as an optional dependency of next
- sharp (JS script; builds from source. Again, sharp is only used during a build script; not imported by any worker code)
This is odd. According to the docs, Worker Builds runs on an x86_64 Ubuntu machine with Node 22 and PNPM preinstalled. The preinstalled tools are confirmed by the log) I'm actually developing & testing on a machine within those same specifications, so it's not a problem with x86_64 Ubuntu, Node 22, or PNPM 14.
It is worth noting that the following dependencies also have postinstall scripts, but are not mentioned as failing:
- core-js (prints a donation banner to the console)
- unrs-resolver (calls another dependency, napi-postinstall, which looks like it's designed to ensure the correct binary file is installed.)
Additionally, the only direct dependency of my project in either list is sharp. Maybe it has something to do with these binary packages? I'm not too sure though—could be anything at this point.
The logs from the build are posted in the message below. PNPM lockfile also included. Git repo not public 😔
Using a monorepo setup with two workers in one repo. PNPM is designed to be able to handle this case, and I've pnpm installed from subdirectories without issue before. Cloudflare's docs also mention using PNPM for this.2 Replies