Skip to content

Deploys fail - EMFILE: too many open files #9754

Open
@Maxservais

Description

@Maxservais

What versions & operating system are you using?

Wrangler, 4.21.2

Please provide a link to a minimal reproduction

No response

Describe the Bug

Bug Report
I am using React-router v7 with Honojs, hosted on Cloudflare workers. Building the code locally and then deploying to cloudflare works flawlessly. However, if I push to github (which triggers a cloudflare deployment), the build fails in Cloudflare's build environment.

It seems lucide-react causes "EMFILE: too many open files" errors during production builds on Cloudflare Workers when using Vite.

I suspect the error comes from the Cloudflare-Vite plugin version

Root Cause:
lucide-react's architecture with thousands of individual ES module files overwhelms file descriptor limits in constrained build environments.

`

11:21:45.559 [commonjs--resolver] Could not load /opt/buildhome/repo/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/log-out.js: EMFILE: too many open files, open '/opt/buildhome/repo/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/log-out.js'
11:21:45.560 at open (node:internal/fs/promises:633:25)
11:21:45.560 at Object.readFile (node:internal/fs/promises:1237:14)
11:21:45.560 at Object.handler (file:///opt/buildhome/repo/node_modules/.pnpm/vite@6.3.5_@types[email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:45843:27)
11:21:45.560 at PluginDriver.hookFirstAndGetPlugin (file:///opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:22170:28)
11:21:45.562 at file:///opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:21174:33
11:21:45.562 at Queue.work (file:///opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:22398:32) {
11:21:45.562 errno: -24,
11:21:45.562 code: 'PLUGIN_ERROR',
11:21:45.562 syscall: 'open',
11:21:45.562 path: '/opt/buildhome/repo/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/log-out.js',
11:21:45.562 pluginCode: 'EMFILE',
11:21:45.562 plugin: 'commonjs--resolver',
11:21:45.562 hook: 'resolveId',

`

Related Issues:

Expected Behavior:
Build should complete successfully.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` package

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions