You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10下执行Bundle Install安装wdm 0.1.1遇Gem::Ext::BuildError错误求助

问题:Windows10搭建GitHub Pages时,Bundle Install安装wdm gem失败

我正在搭建GitHub Pages作品集网站,按官方步骤安装Jekyll和Bundler,环境是Windows10,已完成:

  • 安装带Devkit的Ruby(通过ridk install完成)
  • 安装jekyll和bundler
  • 创建仓库及项目文件夹

执行bundle install时出现wdm gem构建失败的错误,日志如下:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/wdm-0.1.1/ext/wdm
C:/Ruby33-x64/bin/ruby.exe extconf.rb
checking for -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
checking for rb_thread_call_without_gvl()... yes
creating Makefile

current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/wdm-0.1.1/ext/wdm
make DESTDIR\= sitearchdir\=./.gem.20240624-30600-ys16cj
sitelibdir\=./.gem.20240624-30600-ys16cj clean

current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/wdm-0.1.1/ext/wdm
make DESTDIR\= sitearchdir\=./.gem.20240624-30600-ys16cj
sitelibdir\=./.gem.20240624-30600-ys16cj
generating wdm_ext-x64-mingw-ucrt.def
compiling entry.c
compiling memory.c
compiling monitor.c
compiling queue.c
compiling rb_change.c
rb_change.c: In function 'extract_absolute_path_from_notification':
rb_change.c:139:5: warning: 'RB_OBJ_TAINT' is deprecated: taintedness turned out
to be a wrong idea. [-Wdeprecated-declarations]
  139 |     OBJ_TAINT(path);
      |     ^~~~~~~~~
In file included from
C:/Ruby33-x64/include/ruby-3.3.0/ruby/internal/core/rstring.h:30,
from
C:/Ruby33-x64/include/ruby-3.3.0/ruby/internal/arithmetic/char.h:29,
from
C:/Ruby33-x64/include/ruby-3.3.0/ruby/internal/arithmetic.h:24,
                 from C:/Ruby33-x64/include/ruby-3.3.0/ruby/ruby.h:28,
                 from C:/Ruby33-x64/include/ruby-3.3.0/ruby.h:38,
                 from wdm.h:22,
                 from rb_change.c:4:
C:/Ruby33-x64/include/ruby-3.3.0/ruby/internal/fl_type.h:824:1: note: declared
here
  824 | RB_OBJ_TAINT(VALUE obj)
      | ^~~~~~~~~~~~
compiling rb_monitor.c
rb_monitor.c: In function 'rb_monitor_run_bang':
rb_monitor.c:509:29: error: implicit declaration of function
'rb_thread_call_without_gvl' [-Wimplicit-function-declaration]
509 |         waiting_succeeded = rb_thread_call_without_gvl(wait_for_changes,
monitor->process_event, stop_monitoring, monitor);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:248: rb_monitor.o] Error 1

make failed, exit code 2

Gem files will remain installed in
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/wdm-0.1.1 for inspection.
Results logged to
C:/Ruby33-x64/lib/ruby/gems/3.3.0/extensions/x64-mingw-ucrt/3.3.0/wdm-0.1.1/gem_make.out

  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension'
C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in
build_extensions'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/installer.rb:852:in `build_extensions'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/rubygems_gem_installer.rb:79:in
`build_extensions'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/source/rubygems.rb:205:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/installer/gem_installer.rb:54:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/worker.rb:62:in
`apply_func'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/worker.rb:57:in
`block in process_queue'
  <internal:kernel>:187:in `loop'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/worker.rb:54:in
`process_queue'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing wdm (0.1.1), and Bundler cannot continue.

In Gemfile:
  wdm

有没有人遇到过这个错误?该怎么解决?


解决方案

  • 原因:wdm 0.1.1版本过旧,不兼容Ruby 3.3的API变更(rb_thread_call_without_gvl函数声明方式调整)。
  • 解决步骤:
    1. 打开项目根目录的Gemfile,添加或修改wdm的版本约束:
      gem 'wdm', '>= 0.2.0'
      
    2. 执行bundle update wdm更新到兼容版本。
    3. 重新运行bundle install即可完成安装。

备选方案:如果不需要本地实时预览的文件监听功能,可直接在Gemfile中排除wdm:

gem 'wdm', group: :development, require: false

或者安装时跳过开发依赖:

bundle install --without development

内容的提问来源于stack exchange,提问作者état de choses

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 22:57:04