Thursday, August 10, 2017

Linux: Increasing Increasing the amount of inotify watchers

Today, I wanted to add Article and Comment for my Ruby on Rails myapp2 project. It is based on Getting Started with Rails online tutorial (http://guides.rubyonrails.org/getting_started.html).

When I typed Rails generate controller command, something weird was shown on the screen:
jimmyc@Jimmy-C-2017:~/myapp2$ rails generate controller Articles
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.

Then, I searched on Google: "FATAL: Listen error: unable to monitor directories for changes". The search result showed a Stack Overflow article. I also surfed the Github article that was shown on Linux terminal.

I tried to type this command in shell terminal and hopefully it could get through:
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

my shell terminal:
jimmyc@Jimmy-C-2017:~/myapp2$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
[sudo] password for jimmyc:
fs.inotify.max_user_watches=524288
fs.inotify.max_user_watches = 524288

Good, this time the Rails Generate Controller command was successful.
jimmyc@Jimmy-C-2017:~/myapp2$ rails generate controller Articles
Running via Spring preloader in process 3769
      create  app/controllers/articles_controller.rb
      invoke  erb
      create    app/views/articles
      invoke  test_unit
      create    test/controllers/articles_controller_test.rb
      invoke  helper
      create    app/helpers/articles_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/articles.coffee
      invoke    scss
      create      app/assets/stylesheets/articles.scss

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

Listen error: unable to monitor directories for changes
https://stackoverflow.com/questions/42225677/listen-error-unable-to-monitor-directories-for-changes

2 comments:

  1. After reading this blog i very strong in this topics and this blog really helpful to all... explanation are very clear so very easy to understand... thanks a lot for sharing this blog more info on Ruby on Rails Online course

    ReplyDelete
  2. There are actually certain dissertation pages on line training books own obviously shown during the web-site. K1 visa

    ReplyDelete

How to kill an abandoned process in Linux/Unix

I remembered it, then I forgot, then I remembered it, and then I forgot again. In case of a Linux/Unit process hang, I have to figure out ...