Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

events.js:183 throw er; // Unhandled 'error' event

I created a new React Project via the command npx create-react-app agent_mo project. It has been created but while starting it with npm start i am getting the following error

enter image description here

like image 808
Abhishek Goswami Avatar asked Apr 23 '18 07:04

Abhishek Goswami


2 Answers

Run the below command to avoid ENOSPC:

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

For Arch Linux add this line to /etc/sysctl.d/99-sysctl.conf:

fs.inotify.max_user_watches=524288

Then execute:

sysctl --system

This will also persist across reboots.

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

References: Node.js: what is ENOSPC error and how to solve?

like image 133
Ashish Viradiya Avatar answered Oct 03 '22 00:10

Ashish Viradiya


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.

like image 27
Sambulo Senda Avatar answered Oct 02 '22 23:10

Sambulo Senda