This problem is caused by the way Gatsby.js works, generates static files, and optimizes photos, which easily exceeds the defined Listen limit for the number of files that the Linux OS monitors per directory.
Namely, the Linux OS uses Listen inotify to monitor file changes in directories. Therefore, it is not uncommon to encounter a system limit in the number of files you can monitor. For example, the inotify limit on Ubuntu Lucid (64bit) is set to 8192.
What is the current limit of your system you can find out with command:
When the defined limit is not sufficient to track file changes in the directory, you must increase the limit for Listen to work properly.
You can set a new temporary limit with the command:
sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p
If you want to permanently change the Listen limit, use the command:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
If you still have problems with Listen check the values