1. 问题概述:
提示1:
外部文件变更同步可能缓慢
当前 inotify(7) 监视限制过低。更多详细信息。
或Vue提示:
Error from chokidar (/home/.../): Error: ENOSPC: System limit for number of file watchers reached, watch '/home/.../xxx.vue'
提示2:
外部文件变更同步可能缓慢
PyCharm 无法接收此项目的文件系统事件通知。它是否在网络驱动器上?
2. 解决办法
对于提示1,
按照 https://youtrack.jetbrains.com/articles/IDEA-A-2/Inotify-Watches-Limit-Linux 中的说明操作:
Increase the watches limit (to, say, 512K):
Add the following line to either /etc/sysctl.conf file or a new *.conf file (e.g. idea.conf) under /etc/sysctl.d/ directory:
fs.inotify.max_user_watches = 524288
Then run this command to apply the change:
sudo sysctl -p --system
And restart the IDE.
对于提示2,
可能是项目中的某些文件导致的。例如,把一些教程中的代码目录拷贝到项目目录中,由于这些代码目录可能层级很深,就会引发提示2。怀疑是 PyCharm 2022.2.1 (Professional Edition) 的一个Bug。
把项目中除了 .idea/ venv/ main.py 以外的其它目录移至其它目录,然后逐个移回来,每移一个就关闭PyCharm再打开,然后观察是哪个目录中的文件导致的,再进一步查找。