`EMFILE: too many open files` during build

Anyone happen to know anything about the EMFILE: too many open files error with workers builds? I see a bunch of people posting about it in the past, but none of them have any replies. Basically, I'm trying out workers builds for a full-stack site built with SvelteKit, hoping to eventually move my Pages projects to workers since Pages is basically abandoned at this point, but I'm getting this error. I've retried many times and have gotten that error every time. Build works fine locally. Any help with this would be greatly appreciated.
9 Replies
ac
ac•6mo ago
I just started getting this after never seeing it in months of builds, so I'd love to know the answer here too..
Walshy
Walshy•6mo ago
Reported this to the Builds team and they're working on it :)
ajgeiss0702
ajgeiss0702OP•6mo ago
thank you 🙂
red
red•5mo ago
Same here. Following this and the GH issue.
henri
henri•5mo ago
I'm also having the same issue
sug
sug•5mo ago
me too, specficailly seems to get thrown when compiling the Lucide node modules
red
red•5mo ago
Lucide-React causes issues for me too. With Vite? Okay, I found a (sucky-but-works) solution: 1. Use bun build to do the JS bundling into an intermediate build folder (ie: ./dist) 2. Copy an empty index.html file to the ./dist folder, making it point to the ./main.js built by bun. 3. Use vite build to package that with the CSS into one HTML in the distribution folder (ie: ./public). I had to change a few paths, make my index.html file point to my main.js` file, and have all the CSS imports in the index.html, but it works locally, and it deploys properly for now
henri
henri•5mo ago
directly importing each individual icon instead of destructing multiple icons in the same import fixed the issue for me It's not great, but it works
// before
import { EllipsisIcon, CalendarIcon } from 'lucide-svelte';
// after
import EllipsisIcon from 'lucide-svelte/icons/ellipsis';
import CalendarIcon from 'lucide-svelte/icons/calendar';
// before
import { EllipsisIcon, CalendarIcon } from 'lucide-svelte';
// after
import EllipsisIcon from 'lucide-svelte/icons/ellipsis';
import CalendarIcon from 'lucide-svelte/icons/calendar';
red
red•5mo ago
The GH issue mentioned it, but I cannot require like that in React Someone in the GH issue said it was resolved. I checked and it does work again on my side.

Did you find this page helpful?