简体   繁体   English

错误:安装 psych 时出错:错误:无法构建 gem 本机扩展

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

I am trying to update psych to 5.0.0, but I get the following error message:我正在尝试将 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

Tried gem update , gem pristine --all , same error.试过gem updategem pristine --all ,同样的错误。

Any tips how to fix this in Windows?在 Windows 中如何解决此问题的任何提示?

Thank you!谢谢!

You need to install libyaml via pacman -S mingw-w64-ucrt-x86_64-libyaml in the command prompt with ruby您需要在命令提示符下通过pacman -S mingw-w64-ucrt-x86_64-libyaml安装 libyaml ruby

Not sure how it was fixed but I ran gem update and psych was updated to 5.0.2 without an error.不确定它是如何修复的,但我运行了gem update并且 psych 被无误地更新到 5.0.2。

I had a similar problem on Mac running OSX 13.2.我在运行 OSX 13.2 的 Mac 上遇到了类似的问题。 Bundle install failed because it couldn't find yaml.h.捆绑包安装失败,因为找不到 yaml.h。

Since I was on Mac and running Homebrew, I did a因为我在 Mac 上运行 Homebrew,所以我做了一个

brew install libyaml

and then re-ran bundle install.然后重新运行捆绑安装。 It worked correctly.它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:安装jekyll时出错:错误:无法构建gem原生扩展 - ERROR: Error installing jekyll: ERROR: Failed to build gem native extension 安装 libv8 时出错:错误:无法构建 gem 本机扩展 - Error installing libv8: ERROR: Failed to build gem native extension Windows:安装 jekyll 时出错 + gem 更新失败 - 错误:无法构建 gem 本机扩展 - Windows : Error installing jekyll + gem update failed - ERROR: Failed to build gem native extension 如何使用 Windows 使用 bootsnap 修复“无法构建 gem 原生扩展”错误 - How to fix ' Failed to build gem native extension' error with bootsnap with Windows 错误:无法在Windows 7x64上构建gem本机扩展 - ERROR: Failed to build gem native extension on windows 7x64 Gem::Ext::BuildError: 错误:无法构建 gem 本机扩展。 对于 SQLite3 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for SQlite3 ROR错误:无法构建gem本机扩展。 (Gem :: Installer :: ExtensionBuildError) - ROR ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 安装 rails 失败,“无法构建 gem 本机扩展” - installing rails fails, “failed to build gem native extension” 安装json gem时出错:“ json”本机gem需要安装的构建工具 - Error installing json gem: The 'json' native gem requires installed build tools 无法在Windows上构建gem本机扩展 - Failed to build gem native extension on Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM