侦听错误:无法监视目录的更改 [英] Listen error: unable to monitor directories for changes

查看:72
本文介绍了侦听错误:无法监视目录的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Ubuntu 服务器中运行 Rails 应用程序时出现以下错误

I am getting the following error while running my rails app in Ubuntu server

致命:侦听错误:无法监视目录的更改.访问https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers有关如何解决此问题的信息.

FATAL: Listen error: unable to monitor directories for changes. Visit https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers for info on how to fix this.

我已经关注了上面的 GitHub 页面,但是我无法写入设置为 8192 的 max_user_watches,我想将其设置为 524288.在 cat/proc/sys/fs/inotify/max_user_watches 中,该文件处于只读模式.我尝试授予写权限,但即使使用 root 访问,我也收到了权限被拒绝的错误.

I have followed the above GitHub page, but I was unable to write in max_user_watches which were set in 8192 and I want to set that to 524288. in cat /proc/sys/fs/inotify/max_user_watches the file was in only read mode.I tried to grant write permissions, but I was getting permission denied error even with root access.

提前致谢!!!

推荐答案

1000 太小了,尝试使用 524288,如 wiki 页面所述:https://github.com/guard/listen/blob/master/README.md#increasing-the-amount-of-inotify-观察者

1000 is way too small, try with 524288 as explained in the wiki page: https://github.com/guard/listen/blob/master/README.md#increasing-the-amount-of-inotify-watchers

Listen 在 Linux 上默认使用 inotify 来监视目录变化.遇到系统限制数量的情况并不少见您可以监控的文件.例如,Ubuntu Lucid 的(64 位)inotify限制设置为 8192.

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.

如果您运行的是 Debian、RedHat 或其他类似的 Linux分发,在终端中运行以下命令:

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

如果您正在运行 ArchLinux,请改为运行以下命令

If you are running ArchLinux, run the following command instead

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

这篇关于侦听错误:无法监视目录的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆