[Ruby on rails] The rails db: migrate: reset command displays FATAL: Listen error: unable to monitor directories for changes. [Rails tutorial]

About the error

An error occurred when executing the following command.

rails db:migrate:reset
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.

approach

After investigating, it seems that it can be dealt with by changing the instance limit of inotify. Check the following files with cat.

cat /proc/sys/fs/inotify/max_user_instances 
128

We will change from 128 to 524288. Add to the configuration file.

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

Reflects the added file.

sudo sysctl -p

Execute the command that was in error again.

rails db:migrate:reset

The command passed successfully!

Recommended Posts

[Ruby on rails] The rails db: migrate: reset command displays FATAL: Listen error: unable to monitor directories for changes. [Rails tutorial]
Ruby on Rails DB Tips for creating methods to reduce the load
[Ruby on Rails Tutorial] Error in the test in Chapter 3
[Ruby On Rails] How to reset DB in Heroku
[Rails / Heroku / MySQL] How to reset the DB of Rails application on Heroku
Things to remember and concepts in the Ruby on Rails tutorial
[Ruby on Rails] Rails tutorial Chapter 14 Summary of how to implement the status feed
[Ruby on Rails] How to Japaneseize the error message of Form object (ActiveModel)
[Ruby on Rails] How to display error messages
[Rails MySQL] How to reset DB on heroku
[Ruby on rails] When executing the heroku command, bash: heroku: command not found is displayed. [Rails tutorial]
[Ruby on Rails] How to change the column name
From Ruby on Rails error message display to Japanese localization
[Ruby on Rails] Column restrictions when saving to DB (4 representatives)
[For beginners] Build the environment for Ruby on Rails Tutorial 4th Edition (Rails 5.1) in less than an hour!