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
BellCube
BellCubeOP3mo ago
(some early timestamps omitted because of the Discord character limit)
Initializing build environment...
Success: Finished initializing build environment
Cloning repository...
Restoring from dependencies cache
Restoring from build output cache
Detected the following tools from environment: pnpm@10.14.0, nodejs@22.16.0
2025-08-25T19:28:10.309Z Installing project dependencies: pnpm install --frozen-lockfile
2025-08-25T19:28:12.949Z Scope: all 4 workspace projects
2025-08-25T19:28:13.369Z ../.. | Progress: resolved 1, reused 0, downloaded 0, added 0
2025-08-25T19:28:13.615Z ../.. | +1564 ++++++++++++++++++++++++++++
...
2025-08-25T19:29:04.660Z ../.. | Progress: resolved 1564, reused 0, downloaded 1556, added 1564, done
2025-08-25T19:29:05.447Z .../sharp@0.33.5/node_modules/sharp install$ node install/check
2025-08-25T19:29:05.449Z .../node_modules/@parcel/watcher install$ node scripts/build-from-source.js
2025-08-25T19:29:05.450Z .../node_modules/workerd postinstall$ node install.js
2025-08-25T19:29:17.439Z .../esbuild@0.25.8/node_modules/esbuild postinstall$ node install.js
2025-08-25T19:29:17.443Z .../sharp@0.33.5/node_modules/sharp install: Failed
2025-08-25T19:29:17.480Z  ELIFECYCLE  Command failed with exit code -2.
2025-08-25T19:29:17.480Z .../node_modules/@parcel/watcher install: Failed
2025-08-25T19:29:36.849Z .../sharp@0.34.3/node_modules/sharp install$ node install/check.js
2025-08-25T19:29:36.849Z .../esbuild@0.25.8/node_modules/esbuild postinstall: Failed
2025-08-25T19:29:36.850Z .../node_modules/workerd postinstall: Failed
2025-08-25T19:29:37.060Z Failed: error occurred while installing tools or dependencies
2025-08-25T19:29:04.660Z ../.. | Progress: resolved 1564, reused 0, downloaded 1556, added 1564, done
(some early timestamps omitted because of the Discord character limit)
Initializing build environment...
Success: Finished initializing build environment
Cloning repository...
Restoring from dependencies cache
Restoring from build output cache
Detected the following tools from environment: pnpm@10.14.0, nodejs@22.16.0
2025-08-25T19:28:10.309Z Installing project dependencies: pnpm install --frozen-lockfile
2025-08-25T19:28:12.949Z Scope: all 4 workspace projects
2025-08-25T19:28:13.369Z ../.. | Progress: resolved 1, reused 0, downloaded 0, added 0
2025-08-25T19:28:13.615Z ../.. | +1564 ++++++++++++++++++++++++++++
...
2025-08-25T19:29:04.660Z ../.. | Progress: resolved 1564, reused 0, downloaded 1556, added 1564, done
2025-08-25T19:29:05.447Z .../sharp@0.33.5/node_modules/sharp install$ node install/check
2025-08-25T19:29:05.449Z .../node_modules/@parcel/watcher install$ node scripts/build-from-source.js
2025-08-25T19:29:05.450Z .../node_modules/workerd postinstall$ node install.js
2025-08-25T19:29:17.439Z .../esbuild@0.25.8/node_modules/esbuild postinstall$ node install.js
2025-08-25T19:29:17.443Z .../sharp@0.33.5/node_modules/sharp install: Failed
2025-08-25T19:29:17.480Z  ELIFECYCLE  Command failed with exit code -2.
2025-08-25T19:29:17.480Z .../node_modules/@parcel/watcher install: Failed
2025-08-25T19:29:36.849Z .../sharp@0.34.3/node_modules/sharp install$ node install/check.js
2025-08-25T19:29:36.849Z .../esbuild@0.25.8/node_modules/esbuild postinstall: Failed
2025-08-25T19:29:36.850Z .../node_modules/workerd postinstall: Failed
2025-08-25T19:29:37.060Z Failed: error occurred while installing tools or dependencies
2025-08-25T19:29:04.660Z ../.. | Progress: resolved 1564, reused 0, downloaded 1556, added 1564, done

Did you find this page helpful?