Failed to deploy scheduler woker

For Workers & Pages, what is the name of the domain?

thetableapp-tasks.fidel-elie.workers.dev

What is the error number?

N/A

What is the error message?

20:07:26.010 pnpm: EMFILE: too many open files, open ‘/opt/buildhome/repo/apps/tasks/node_modules/esbuild-register/package.yaml’ 20:07:26.010 at async open (node:internal/fs/promises:638:25) 20:07:26.013 at async Object.readFile (node:internal/fs/promises:1238:14) 20:07:26.013 at async readPackageYaml (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:18248:16) 20:07:26.013 at async tryReadProjectManifest (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:18168:26) 20:07:26.013 at async readProjectManifest (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:18123:23) 20:07:26.013 at async readProjectManifestOnly (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:18130:28) 20:07:26.014 at async safeReadProjectManifestOnly (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:18114:16) 20:07:26.014 at async getPackageBins (/opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:105364:52) 20:07:26.014 at async /opt/buildhome/.cache/node/corepack/v1/pnpm/9.11.0/dist/pnpm.cjs:105296:22 20:07:26.014 at async Promise.all (index 0) 20:07:26.257 Failed: error occurred while installing tools or dependencies

What is the issue or error you’re encountering

Worker fails to deploy with confusing error using wrangler I have another server that has deployed fine with a similar configuration.

What are the steps to reproduce the issue?

Deploy a cloudflare worker with a these config using pnpm

tsconfig.json

{
“extends”: “../../tsconfig.json”,
“compilerOptions”: {
“target”: “ESNext”,
“module”: “ESNext”,
“lib”: [
“ESNext”
],
“moduleResolution”: “bundler”,
“types”: [“@cloudflare/workers-types”]
},
“include”: [“**/*.ts”]
}

wrangler.json

{
“$schema”: “../../node_modules/wrangler/config-schema.json”,
“name”: “tasks”,
“main”: “index.ts”,
“compatibility_date”: “2025-04-05”,
“dev”: {
“port”: 8081
},
“observability”: {
“enabled”: true
},
“triggers”: {
“crons”: [
“0 8 * * *” // Every day at 8
]
}
}

package.json

{
“name”: “tasks”,
“version”: “1.0.0”,
“private”: true,
“scripts”: {
“dev”: “wrangler dev --test-scheduled --show-interactive-dev-session=false --inspector-port=0”,
“push”: “wrangler deploy”,
“wrangler”: “wrangler”
},
“devDependencies”: {
@cloudflare/workers-types”: “^4.20250405.0”,
“wrangler”: “^4.10.0”
},
“dependencies”: {
@localpackage/api”: “workspace:^”
}
}

Screenshot of the error

ive received the same error

So I think I may have found a way to fix this. it looks like when the cloudflare builder runs the install command it runs it in the root pacakge so ends up installing everything. So instead:

  • Override the builder so it doesn’t run the install dependencies command itself. To do this, add SKIP_DEPENDENCY_INSTALL=true as a build environment variable to the worker. This can be done in setting or when creating it for the first time.
  • Set the build command for the worker to whatever your preferred dependency install command is for me it was just pnpm install.

The error would not come up on a rebuild for me a lot of the time if I triggered this from the dashboard but when pushing new code to the repo branch and triggering a new build that way it would fail consistently with this error.

Hopefully, this works for you as well.

This topic was automatically closed after 15 days. New replies are no longer allowed.