ruby-on-rails – Ruby错误:无法加载此类文件 – wdm(LoadError)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Ruby错误:无法加载此类文件 – wdm(LoadError)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 Windows上遇到了一些与Jekyll有关的重大问题.我终于开始工作,所以我跑了

jekyll build

然后

jekyll serve –watch

然后我得到以下错误,有人可以帮忙吗?

完整的错误是:

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
cannot load such file -- wdm (LoadError)
        from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
n `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:207:in `load_dependent_adapter'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
s/windows.rb:33:in `load_dependent_adapter'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:198:in `usable?'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
s/windows.rb:25:in `usable?'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:190:in `usable_and_works?'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:57:in `block in select_and_initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:55:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter
.rb:55:in `select_and_initialize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listene
r.rb:291:in `initialize_adapter'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listene
r.rb:283:in `setup'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listene
r.rb:52:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.0/lib/jekyll/command
s/build.rb:56:in `watch'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.0/lib/jekyll/command
s/build.rb:8:in `process'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.0/bin/jekyll:97:in `
block (2 levels) in <top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/c
ommand.rb:180:in `call'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/c
ommand.rb:180:in `call'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/c
ommand.rb:155:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/r
unner.rb:402:in `run_active_command'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/r
unner.rb:66:in `run!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/d
elegates.rb:11:in `run!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/i
mport.rb:10:in `block in <top (required)>'

解决方法

你似乎正在使用一个非常古老的listen gem版本(1.3.1).尝试更新到最新版本(2.4.0)
$gem update listen

在你的Gemfile中:

require 'rbconfig'

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

添加了gem wdm,因为我不确定listen gem是否会require it by itself,但是自述状态指出这是可选的,否则它将回退到轮询,这是一种效率较低的方式.

原文链接:https://www.f2er.com/ruby/271088.html

猜你在找的Ruby相关文章