question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vite build is opening too many files

See original GitHub issue

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/).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
schummarcommented, Jan 23, 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, https://github.com/rollup/rollup/pull/4200

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

2reactions
floklicommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite build produces too many files : r/vuejs - Reddit
Vite build produces too many files. I am converting a project from Webpack to Vite. It is all great in dev - the...
Read more >
Troubleshooting - Vite
As Vite does not bundle most of the files, browsers may request many files which require many file descriptors, going over the limit....
Read more >
node and Error: EMFILE, too many open files - Stack Overflow
I went to XCode, my app, Build Phases, found Bundle React Native code and images and changed node , to the output of...
Read more >
Vite use js instead of jsx
All of your application's assets, such as images, videos, and other files ... I won't dive too deeply into build configs here, but...
Read more >
Troubleshooting | Vite Ruby
Add a file path or dir glob in watchAdditionalPaths to ensure changes to ... Too many open files along with #<SocketError: Failed to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found