Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite build is opening too many files #4438

Closed
flokli opened this issue Jul 29, 2021 · 5 comments
Closed

vite build is opening too many files #4438

flokli opened this issue Jul 29, 2021 · 5 comments

Comments

@flokli
Copy link

flokli commented Jul 29, 2021

Describe the bug

I'm trying to build an application, but developers keep running into "too many open files" issues.

I know too many open files issues can be worked around by raising ulimit etc, but there is an upper limit.

However, I doubt there's a reason for vite build too keep that many files open at the same time.

Can this be changed, so files are not kept open for so long/only a reasonable number of files is kept open?

Reproduction

Build a project with a large number of dependencies.

System Info

vite 2.4.4

Used Package Manager

npm

Logs

> blub-ui@1.0.0 build /build/source
> vite build

vite v2.4.4 building for production...

warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
'react' is imported by react?commonjs-external, but could not be resolved – treating it as an external dependency
'linkify-it' is imported by linkify-it?commonjs-external, but could not be resolved – treating it as an external dependency
'tlds' is imported by tlds?commonjs-external, but could not be resolved – treating it as an external dependency
✓ 2435 modules transformed.
[load-fallback] Could not load /nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/PlayArrowTwoTone.js (imported by ../../nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/index.js): EMFILE: too many open files, open '/nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/PlayArrowTwoTone.js'
error during build:
Error: Could not load /nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/PlayArrowTwoTone.js (imported by ../../nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/index.js): EMFILE: too many open files, open '/nix/store/d3nah5l7ff9clkad974nmq686cmn325c-blub-ui-1.0.0/node_modules/@material-ui/icons/esm/PlayArrowTwoTone.js'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! blub-ui@1.0.0 build: `vite build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the blub-ui@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2021-07-29T11_32_46_689Z-debug.log


### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/.github/contributing.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
@schummar
Copy link
Contributor

The issue is kind of old, but in case anybody else still has the problem: I encountered it too and was able to solve it with a fix in rollup: #rollup 4170, rollup/rollup#4200

Make sure you have rollup >= 2.53.0 in your dependencies and try again.

@mellson
Copy link

mellson commented Feb 28, 2022

We're experiencing this issue when pre-bundling, but only on Windows. So far the only solution we have to this problem is to install WSL on the affected machines and run a linux version of node (that solves it).

@flokli
Copy link
Author

flokli commented Feb 28, 2022

The issue is kind of old, but in case anybody else still has the problem: I encountered it too and was able to solve it with a fix in rollup: #rollup 4170, rollup/rollup#4200

Make sure you have rollup >= 2.53.0 in your dependencies and try again.

Thanks! Let's close this then.

@flokli flokli closed this as completed Feb 28, 2022
@mellson
Copy link

mellson commented Feb 28, 2022

The suggested fix does not work for our problem. But I'll open a new issue with a more specific error description at some point.

@nguyenit67
Copy link

nguyenit67 commented Mar 3, 2022

Make sure you have rollup >= 2.53.0 in your dependencies and try again.

thanks so much, this fixed my problem instantly 😄

@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants