簡體   English   中英

錯誤:安裝 psych 時出錯:錯誤:無法構建 gem 本機擴展

[英]ERROR: Error installing psych: ERROR: Failed to build gem native extension

我正在嘗試將 psych 更新到 5.0.0,但收到以下錯誤消息:

Updating psych
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing psych:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/psych-5.0.0/ext/psych
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 extconf.rb
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
.
.
.

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/psych-5.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/psych-5.0.0 for inspection.
Results logged to C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/psych-5.0.0/gem_make.out

試過gem updategem pristine --all ,同樣的錯誤。

在 Windows 中如何解決此問題的任何提示?

謝謝!

您需要在命令提示符下通過pacman -S mingw-w64-ucrt-x86_64-libyaml安裝 libyaml ruby

不確定它是如何修復的,但我運行了gem update並且 psych 被無誤地更新到 5.0.2。

我在運行 OSX 13.2 的 Mac 上遇到了類似的問題。 捆綁包安裝失敗,因為找不到 yaml.h。

因為我在 Mac 上運行 Homebrew,所以我做了一個

brew install libyaml

然后重新運行捆綁安裝。 它工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM