14

I have just reinstalled my whole system and started working on my projects again. I used and still use Jekyll in some of them however I have a problem with auto generation using --auto or _config.yml's auto: true. It simply doesn't work. The output for jekyll --server --auto is:

Configuration from /home/rafal/Documents/Projects/ruby-adventure/_config.yml
Auto-regenerating enabled: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
[2013-03-23 19:09:53] regeneration: 1 files changed
[2013-03-23 19:09:53] INFO  WEBrick 1.3.1
[2013-03-23 19:09:53] INFO  ruby 2.0.0 (2013-02-24) [x86_64-linux]
[2013-03-23 19:09:53] WARN  TCPServer Error: Address already in use - bind(2)
[2013-03-23 19:09:53] INFO  WEBrick::HTTPServer#start: pid=3288 port=4000
[2013-03-23 19:09:53] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed

The output from jekyll --no-auto --server is:

Configuration from /home/rafal/Documents/Projects/ruby-adventure/_config.yml
Building site: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
Successfully generated site: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
[2013-03-23 19:12:31] INFO  WEBrick 1.3.1
[2013-03-23 19:12:31] INFO  ruby 2.0.0 (2013-02-24) [x86_64-linux]
[2013-03-23 19:12:31] WARN  TCPServer Error: Address already in use - bind(2)
[2013-03-23 19:12:31] INFO  WEBrick::HTTPServer#start: pid=3327 port=4000

...so no error pops up. The site generates fine but when I change a file, it isn't auto regenerated. Any ideas why?

  • Yup, can reproduce. The server sometimes needs to be restarted after files change, otherwise it doesn’t pick the changes up. Go file a bug on the GitHub project page. – Konrad Rudolph Mar 23 '13 at 19:21
  • Which Jekyll version are you using? 0.12.1? I used it and it worked correctly, i.e. it regenerates after you edit & save a file being watched. The result from `jekyll --no-auto --server` shouldn't include the `regenation: 1 files changed` statement. – Carlos Agarie Mar 24 '13 at 07:39
  • Getting the same issue with 0.12.1. What's very odd though is that whenever I save `_config.yml`, it suddenly picks up all the changes made anywhere else and regenerates the files as it should. Anyone getting the same? – simonrohrbach Mar 25 '13 at 01:43

2 Answers2

42

Seems to be caused by recent changes to the directory_watcher gem. Rolling the gem back fixed the issue for me:

sudo gem uninstall directory_watcher && sudo gem install directory_watcher -v 1.4.1
liliakai
  • 602
  • 7
  • 7
  • Yup, fixed it for me too. Thanks! – simonrohrbach Mar 25 '13 at 14:41
  • this worked, but now it endlessly loops on "5 files changed" without any file saves. ideas? – Joel Grannas Apr 04 '13 at 16:23
  • @JoelGrannas install v1.0.0.beta4 and it should be fixed! – Alexander Ekdahl Apr 11 '13 at 23:16
  • 1
    This was the solution for me, except that I had to remove the `sudo`s from that command. Otherwise, when trying to uninstall, I got the message `INFO: gem "directory_watcher" is not installed`. This might have something to do with the face that my `GEM_HOME` is `/usr/local/` – Jian Apr 14 '13 at 07:38
  • For those who use RVM, don't forget to remove the two `sudo`: `gem uninstall directory_watcher && gem install directory_watcher -v 1.4.1` (like @Jian I think) – Dorian Apr 17 '13 at 15:46
  • Damn it's 17th april and the issue is still there – alex88 Apr 17 '13 at 18:00
  • I also had to remove sudo. I'm using rvm here, so this is what I did: `gem uninstall directory_watcher` `gem install directory_watcher -v 1.4.1` –  Apr 18 '13 at 01:58
  • I tried this but even after `sudo gem uninstall directory_watcher` (non-`sudo` doesn't work for me) jekyll still runs and continually produces these `regeneration: 1 files changed` messages. – Dan Gravell Jun 10 '14 at 14:14
3

I was able to fix this by hard-locking the directory_watcher gem as per @lilakai, but I did it a different way:

Added this line to my gemfile (within the development group):

gem 'directory_watcher', '1.4'

And ran:

bundle update directory_watcher

Everything worked once I did this (as it locked my version to 1.4, which I confirmed via the Gemfile.lock). I prefer managing all of my gems directly through bundler as opposed to through system ruby.

I ran into this problem using the most recent version of Octopress (https://github.com/imathis/octopress) at the time of this post.

ryanjones
  • 5,383
  • 4
  • 28
  • 24
  • God thank you for posting this just fixed my `rake watch` loop bug. I set my directory_watcher to 1.4.4 – backus Jun 06 '13 at 21:57