middleman / middleman

Hand-crafted frontend development
https://middlemanapp.com
MIT License
7.04k stars 746 forks source link

Windows 7, Middleman 3.1.3 #952

Closed keeganstreet closed 11 years ago

keeganstreet commented 11 years ago

Hi,

I get an error when running Middleman on Windows 7.

Ruby version: ruby 2.0.0p195 (2013-05-14) [x64-mingw32]

Middleman version: 3.1.3

Error:

== The Middleman is loading
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/adapter.rb:207:i
n `require': cannot load such file -- wdm (LoadError)
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:207:in `load_dependent_adapter'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pters/windows.rb:33:in `load_dependent_adapter'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:198:in `usable?'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pters/windows.rb:25:in `usable?'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:190:in `usable_and_works?'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:57:in `block in select_and_initialize'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:55:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/ada
pter.rb:55:in `select_and_initialize'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/lis
tener.rb:288:in `initialize_adapter'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/lis
tener.rb:280:in `setup'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/listen-1.2.2/lib/listen/lis
tener.rb:52:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/preview_server.rb:127:in `start_file_watcher'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/preview_server.rb:175:in `mount_instance'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/preview_server.rb:20:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/cli/server.rb:73:in `server'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/comman
d.rb:27:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invoca
tion.rb:120:in `invoke_command'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363
:in `dispatch'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.r
b:439:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/cli.rb:77:in `method_missing'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/comman
d.rb:29:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/comman
d.rb:128:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invoca
tion.rb:120:in `invoke_command'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363
:in `dispatch'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.r
b:439:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/mi
ddleman-core/cli.rb:22:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/bin/mi
ddleman:18:in `<top (required)>'
        from C:/Ruby200-x64/bin/middleman:23:in `load'
        from C:/Ruby200-x64/bin/middleman:23:in `<main>'

List of installed bundles:

Using i18n (0.6.4)
Using multi_json (1.7.7)
Using activesupport (3.2.12)
Using chunky_png (1.2.8)
Using coffee-script-source (1.6.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using fssm (0.2.10)
Using sass (3.2.9)
Using compass (0.12.2)
Using ffi (1.9.0)
Using tilt (1.3.7)
Using haml (4.0.3)
Using hike (1.2.3)
Using kramdown (1.0.2)
Using rb-fsevent (0.9.3)
Using rb-inotify (0.9.0)
Using rb-kqueue (0.2.0)
Using listen (1.2.2)
Using bundler (1.3.5)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using thor (0.18.1)
Using middleman-core (3.1.3)
Using middleman-more (3.1.3)
Using sprockets (2.10.0)
Using sprockets-helpers (1.0.1)
Using sprockets-sass (1.0.1)
Using middleman-sprockets (3.1.2)
Using uglifier (2.1.1)
Using middleman (3.1.3)

Can you please advise what is going wrong?

keeganstreet commented 11 years ago

I updated my Gemfile so it looks like this:

gem "wdm", "~>0.1.0"
gem "middleman", "~>3.1.3"

And now it works.

Maybe you need to add wdm to the Middleman Gemfile?

tdreyno commented 11 years ago

wdm is part of the default Gemfile now, but commented out as it is only for Windows. Was this an older project?

keeganstreet commented 11 years ago

Hey Thomas, this is on a brand new computer. I have just installed Ruby on it today. The project itself is old, yes, but its Gemfile specifies "middleman", "~>3.1.3" so I don't see how it would be trying to use old gem settings.

tdreyno commented 11 years ago

If you were to run middleman init, the Gemfile that generates should now contain wdm (commented out).

keeganstreet commented 11 years ago

Thanks @tdreyno, it does. If we have a project where some developers use Mac and some use Windows, I guess this means we will have to leave the Gemfile and Gemfile.lock out of version control.

bhollis commented 11 years ago

You could do this in your Gemfile:

if RUBY_PLATFORM =~ /win32/
   gem "wdm"
end

Maybe our generated Gemfile should do that.

keeganstreet commented 11 years ago

Oh thanks @bhollis, that sounds like a good solution for the Gemfile. Would it be possible to do anything with the Gemfile.lock? As I understand it is recommended that this file is also checked into version control for Ruby apps (reference: http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/).

I think this must be a problem other Ruby apps have solved before. Maybe I shouldn't be checking the Gemfile.lock file into version control for projects that are used on Windows and Mac.

tdreyno commented 11 years ago

Bundler has built-in support for this like so:

gem "wdm", :platforms => [:mswin, :mingw]
tgdev commented 11 years ago

Thanks so much for this. I was having the same issue on my project (I'm also a Windows 7 user).

Upgraded middleman from 3.0.11 to 3.1.3 and got the same error as @keeganstreet. Messed around with this for ages before adding @tdreyno's solution above.

bhollis commented 11 years ago

@tdreyno fixed our Gemfile template to automatically include wdm on Windows platforms in 5806f2cbf53cb9b64a0904b6b91a977d8a8807b7.

tdreyno commented 11 years ago

:+1:

raghutelkar commented 9 years ago

Thanks guys for posting... 'middleman init' really helped me to resolve issues.