gem 安装失败,无法识别“补丁”(Windows)

Posted

技术标签:

【中文标题】gem 安装失败,无法识别“补丁”(Windows)【英文标题】:gem install fails with 'patch' not recognized (windows) 【发布时间】:2015-09-15 21:21:00 【问题描述】:

我在 Windows 上安装 therubyracer gem 并收到有关“'patch' 未被识别为内部或外部命令、可运行程序或批处理文件”的错误。我需要这个 gem,因为当我尝试使用 less 时,它说要安装 therubyracer。

这是完整的输出:

C:\>ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

C:\>gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

    C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150629-3268-otarv8.rb extconf.rb
creating Makefile
'patch' is not recognized as an internal or external command,
operable program or batch file.
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/patcher.rb:50:in `block (2 levels) in patch!': failed to apply
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/patcher.rb:48:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/patcher.rb:48:in `block in patch!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/patcher.rb:44:in `open'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/patcher.rb:44:in `patch!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/builder.rb:57:in `block in build_libv8!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/builder.rb:52:in `chdir'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/builder.rb:52:in `build_libv8!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9/ext/libv8/location.rb:24:in `install!'
        from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.9 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/libv8-3.16.14.9/gem_make.out

提到的日志文件不包含以上信息。

我什至不知道从哪里着手解决这个问题。

注意:我在C:\RubyDevKit-mingw64-64-4.7.2 安装了 ruby​​ 开发工具包

编辑:

我这样做是因为我正在运行 jekyll 并尝试使用 Less for Jekyll。

基于其他一些answers on ***,我安装了旧版本(3.11.8.0)的 libv8 gem。它安装正确,但没有修复错误。看起来有点像 therubyracer 包含它自己的 libv8 副本。

我安装了"therubyracer_for_windows" 包。但在那之后,当我尝试运行 jekyll serve 时,我得到了错误:

Configuration file: C:/data/adamantworks/Adamantworks.Web-jekyll/_config.yml
jekyll 2.5.2 | Error:  uninitialized constant V8::JSError

因此,似乎其中包含与 jekyll 不兼容的过时内容。我卸载了 therubyracer_for_windows。

【问题讨论】:

您是否尝试过使用 Git Bash 运行命令? 【参考方案1】:

我也遇到了同样的问题。制作bundle update libv8 并完成;)

【讨论】:

这会给出相同的错误,但路径略有不同

以上是关于gem 安装失败,无法识别“补丁”(Windows)的主要内容,如果未能解决你的问题,请参考以下文章

win7补丁安装失败,Win7补丁安装不上怎么办?

Windows无法连接到打印机操作失败,错误为0x00000bcb

win7中无法安装IE11提示更新失败怎么办

使用“gem pq”安装 PostgreSQL gem 失败并出现错误:无法构建 gem 本机扩展

window7旗舰版安装IE10时要安装补丁, Windows 更新程序 总失败怎么办?

windows使用记录---2019.8月补丁更新后出现windows7系列UEFI无法启动解决办法