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.

Bug: Error: EMFILE: too many open files, open 'C:\xxx\web\build\static\js\main.b1a04325.chunk.js'

See original GitHub issue

I use serve to serve my React app because this docs said so: https://create-react-app.dev/docs/deployment/

React version: 16.12.0 OS: Win 10 x64

Steps To Reproduce

  1. Create a React app.
  2. Let a lot of users use it.

The current behavior

After dozens of minutes of access (~ 20 requests/second), I always encounter such error. It seems that too many people are reading the static files.

Microsoft Windows [Version 10.0.17763.914]
(c) 2018 Microsoft Corporation

C:\xxx\web>serve -s build -l 6001

C:\xxx\web>"node"  "C:\Users\Administrator\AppData\Roaming\npm\\node_modules\serve\bin\serve.js" -s build -l 6001

   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚                                                 β”‚
   β”‚   Serving!                                      β”‚
   β”‚                                                 β”‚
   β”‚   - Local:            http://localhost:6001     β”‚
   β”‚   - On Your Network:  http://172.17.10.7:6001   β”‚
   β”‚                                                 β”‚
   β”‚   Copied local address to clipboard!            β”‚
   β”‚                                                 β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


INFO: Gracefully shutting down. Please wait...
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, open 'C:\xxx\web\build\static\js\main.b1a04325.chunk.js'
Emitted 'error' event on ReadStream instance at:
    at internal/fs/streams.js:120:12
    at FSReqCallback.oncomplete (fs.js:146:23) {
  errno: -4066,
  code: 'EMFILE',
  syscall: 'open',
  path: 'C:\\xxx\\web\\build\\static\\js\\main.b1a04325.chunk.js'
}

The expected behavior

No error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
callaincommented, Mar 11, 2020

Hello, I am not sure this bug should be closed, even if it’s not suitable for production. It should correctly closes files

1reaction
hsluoyzcommented, Feb 27, 2020

Finally I used waitress

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: EMFILE: too many open files, open 'C:\xxx\web\build ...
Bug: Error: EMFILE: too many open files, open 'C:\xxx\web\build\static\js\main.b1a04325.chunk.js' #17866.
Read more >
node and Error: EMFILE, too many open files - Stack Overflow
This command will output the number of open handles for nodejs processes: ... Using the graceful-fs module by Isaac Schlueter (node.js maintainer) isΒ ......
Read more >
Unable to deploy Angular .NET Core 3,1 Web App to Azure ASE
I am using "Deploy Node.js app to Azure App Service". This is the error I am getting: Error: EMFILE: too many open files,...
Read more >
Fix 'EMFILE: too many open files' error in Jest - SeanMcP.com
When trying to run Jest in watch mode, this error may mean that you are missing a dependency.
Read more >
Error: EMFILE: too many open files - Expo forums
Running 'expo start' suddenly gives this error: Expo Press ? to show a list of all available commands. Logs for your project will...
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