Guard won't load WDM
Asked Answered
A

3

7

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

Adamek answered 26/4, 2013 at 9:22 Comment(2)
I forgot to add that I actually did do that. That's what's messing me up. I should add that I have two Ruby installations on my system. The one that came with the RailsInstaller, and the one I was using before. I ran 'gem install wdm' from both my regular shell and the RailsInstaller shell, but I can't get this to work.Adamek
I uninstalled both my previous Ruby installation as well as the RailsInstaller installation and re-installed RailsInstaller only. Still having the same issue.Adamek
A
14

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?

Adamek answered 26/4, 2013 at 20:58 Comment(1)
It does and it should. github.com/guard/listen/issues/149 Unfortunately it's not working atm but guard polling without wdm is pretty much useless if livereload is part of the workflow.Frontlet
S
1

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.

Selfseeking answered 23/8, 2013 at 20:49 Comment(0)
A
0

Like said Binary Phile If you use rails in both windows and unix-like, you should use this in your Gemfile :

gem 'wdm','>= 0.1.0', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

it works fine and it's readable.

Austronesia answered 4/4, 2018 at 19:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.