Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 630
afkbowflexin Avatar asked Apr 26 '13 09:04

afkbowflexin


2 Answers

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?

like image 52
afkbowflexin Avatar answered Nov 18 '22 16:11

afkbowflexin


Can't find where I got this recommendation from, but I was given the following for running guard across windows and linux:

gem 'rb-inotify', github: 'nex3/rb-inotify', platforms: :ruby, require: false
gem 'wdm', platforms: :mingw, require: false

The false's make it so the gems are only attempted to be loaded when running on that platform. Your windows environment may need mswin instead of mingw, depending on which ruby install you're using.

like image 1
Binary Phile Avatar answered Nov 18 '22 15:11

Binary Phile