27

I installed ExtReact, with examples. When I run

npm start

I get an error:

ERROR in [@extjs/reactor-webpack-plugin]: Error:
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.BasicException: User limit of inotify watches 
reached
[ERR]
[ERR] Total time: 13 seconds

[ERR] /home/user/project/build/ext-react/build.xml:101: 
com.sencha.exceptions.BasicException: User limit of inotify watches reached
[ERR] A log is available in the file "/home/user/project/build/ext-
react/sencha-error-20171027.log"

How to fix this error?

Sizuji
  • 868
  • 2
  • 9
  • 26

4 Answers4

63

Why?

Programs that sync files such as dropbox, git etc use inotify to notice changes to the file system. The limit can be see by -

cat /proc/sys/fs/inotify/max_user_watches

For me, it shows 100000. When this limit is not enough to monitor all files inside a directory it throws this error.


Increasing the amount of inotify watchers(Short version):

If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

If you are running ArchLinux, run the following command instead (see here for why):

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

Then paste it in your terminal and press on enter to run it.


Technical details:

Listen uses inotify by default on Linux to monitor directories for changes. It's not uncommon to encounter a system limit on the number of files you can monitor. For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.

You can get your current inotify file watch limit by executing:

cat /proc/sys/fs/inotify/max_user_watches

When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.

You can set a new limit temporary with:

sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p

If you like to make your limit permanent, use:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

You may also need to pay attention to the values of max_queued_events and max_user_instances if Listen keeps on complaining.

Source: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

128KB
  • 398
  • 3
  • 12
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • 1
    Without understanding at all what is going on, this answer solved my problem while the accepted one did nothing (at least immediately). Probably it needs a "sudo sysctl -p"? – CPBL Jan 21 '19 at 19:32
  • 1
    I stumble across this answer all the time so I'd like to add that the value 524288 is actually the number of bytes allows, not the number of file watches (which makes sense, that would be a ton of files to watch). 32 bit systems require 540 bytes per file watched and 64 bit systems use double that. I found this info in this answer: https://unix.stackexchange.com/a/13757. – Matt Jun 28 '19 at 11:19
12

I solved this problem by editing /etc/sysctl.conf. To the file I added

fs.inotify.max_user_watches=100000
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Sizuji
  • 868
  • 2
  • 9
  • 26
3

Increase watches

  • cat /proc/sys/fs/inotify/max_user_watches

  • sudo vim /etc/sysctl.conf

  • adding this line to the end of the file:

    fs.inotify.max_user_watches=524288
    
  • sudo sysctl -p

  • echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Else visit https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

vvvvv
  • 25,404
  • 19
  • 49
  • 81
MADHUR GUPTA
  • 1,014
  • 10
  • 14
3

On Linux mint, Run this command and you are good to go

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
ephantus okumu
  • 178
  • 2
  • 11