Search code examples
ruby-on-railsrubyguard

Guard won't load WDM


I'm working through Michael Hartl's Rails tutorial which is excellent so far. I'm on the Advanced Setup Chapter, where he goes through configuring the Rails environment in a way conducive to TDD. I installed Guard, and it runs properly all the way through running the tests I have in my spec/ folder. But then, it spits out this error:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.0.2/lib/listen/adapter.rb:195:in `require': cannot load such file -- wdm (LoadError)

I have wdm installed. I don't know why it can't load it.

It seems like Listen is having problems loading up WDM. It quits after it says "Guard is now watching..."

I haven't reproduced the rest of the stack trace for obvious reasons. I installed Rails using the latest Rails Installer. What's going on here? Do I need to worry about this? It appears to work at least partially...


Solution

  • So here's what happened. By default, on Windows, Listen is supposed to use polling to check for filesystem changes. For some reason it was trying to use WDM. So, I had to had this to my Gemfile:

    require 'rbconfig'
    gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
    

    Maybe Guard makes Listen try to use WDM?