Error: ENFILE: file table overflow, scandir while run reaction on Mac
Asked Answered
S

3

36

I'm trying to install and run Reaction on mac osx 10.12.15 within below command

npm install -g reaction-cli reaction init cd reaction reaction

Then I got below error I'm just fresh with Reactjs developer so it is simply nervously. And it simply compatible with the package version but how can i solve this problem

=> Started proxy.
=> Started MongoDB.
/Users/sopheak/.meteor/packages/templating-compiler/.1.3.2.1411czp++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:190
      throw error;
      ^
Error: ENFILE: file table overflow, scandir '/Users/sopheak/Documents/cam/react/reaction/packages/gridfs'
    at Error (native)
    at Object.fs.readdirSync (fs.js:808:18)
    at Object.wrapper (/tools/fs/files.js:1586:35)
    at readDirectory (/Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/fs/watch.js:338:26)
    at Watcher._fireIfDirectoryChanged (/Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/fs/watch.js:490:23)
    at /Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/fs/watch.js:747:12
    at Array.forEach (native)
    at Function._.each._.forEach (/Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at Watcher._checkDirectories (/Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/fs/watch.js:736:7)
    at new Watcher (/Users/sopheak/.meteor/packages/meteor-tool/.1.5.0.15auley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/fs/watch.js:435:10)
    at setupClientWatcher (/tools/runners/run-app.js:800:23)
    at [object Object]._.extend._runOnce (/tools/runners/run-app.js:811:7)
    at [object Object]._.extend._fiber (/tools/runners/run-app.js:890:28)
    at /tools/runners/run-app.js:417:12
Succumb answered 10/7, 2017 at 5:29 Comment(0)
C
86

This is might be due to the limit on file open files on mac. By default it is set to low. You will need to increase the default size.

$ echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
$ echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -w kern.maxfiles=65536
$ sudo sysctl -w kern.maxfilesperproc=65536
$ ulimit -n 65536 

Refer this link for more details.

Cychosz answered 10/7, 2017 at 6:7 Comment(4)
its happening in windows 10... do you know what the command for windows?Zurek
Having same ulimit on kern.maxfiles and kern.maxfilesperproc got me random crashes of different programs while trying to build stuff (because node depleted all the limit and other programs couldn't open files). Also, 65k is a bit of small limit considering current size of node_modules =)Effluence
Thanks! You are the best! I had this issue when trying to publish thru expoProdigious
This worked for me, but with increasing to 524288Capuche
S
3

I was facing similar issue. I tried with maxfiles=65536 but got the same error.

Then I tried with 524288, as suggested by one in comments and it worked.

Command:

echo kern.maxfiles=524288 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=524288
sudo sysctl -w kern.maxfilesperproc=524288
ulimit -n 524288 

Hope it will help others too

Submaxillary answered 8/3 at 2:48 Comment(0)
H
1

sudo launchctl limit maxfiles 16384 16384 && ulimit -n 16384

Hanger answered 18/8, 2021 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.