Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save x-yuri/a81ffbada04de571bb905661f43ca309 to your computer and use it in GitHub Desktop.

Select an option

Save x-yuri/a81ffbada04de571bb905661f43ca309 to your computer and use it in GitHub Desktop.
rake: FATAL: Listen error: unable to monitor directories for changes.

I was building a docker image. Nothing foretold troubles, but then:

       Step 7/13 : RUN SECRET_KEY_BASE=`bin/rake secret` RAILS_ENV=production         bin/rails assets:precompile
        ---> Running in 51605ddacc67
       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.

Okay, the system was out of inotify watches, but why would I want that in the first place? Inspecting $GEM_HOME revealed that this message comes from—not surprisingly—the listen gem. Which is needed by spring-watcher-listen (Gemfile.lock). Which was added to rails in 5.0.0.beta3.

But why does spring start again? Well, the culprit is bin/rake secret command. Had it been bin/rails secret, the issue wouldn't have arised. That's because only bin/rails {console,runner,generate,destroy,test} start the spring server. The other subcommands don't.

P.S. Make sure you do bundle install --without development test in production. Missing spring gem gets ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment