我正在尝试更新 Rails 应用程序中的一些 gem,当一个名为 psych 5.0.2 的 gem 时,我收到以下错误。 我在一些网站上看到过有关此问题的类似报告,但没有任何帮助我。任何帮助将不胜感激。
版本:Windows 10,Ruby:3.05,Rails:7.0.0(刚刚从 5.2.2 更改),Bundler:2.2.33
Using stringio 3.0.4
Fetching psych 5.0.2
Installing psych 5.0.2 with native extensions
error: failed retrieving file 'mingw-w64-x86_64-libyaml-0.2.2-1-any.pkg.tar.xz' from repo.msys2.org : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-libyaml-0.2.2-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-libyaml-0.2.2-1-any.pkg.tar.xz' from www2.futureware.at : The requested URL returned error: 404
error: failed retrieving file 'mingw-w64-x86_64-libyaml-0.2.2-1-any.pkg.tar.xz' from mirror.yandex.ru : The requested URL returned error: 404
warning: failed to retrieve some files
error: failed to commit transaction (unexpected error)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/psych-5.0.2/ext/psych
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r
./siteconf20230120-15584-xuwv0b.rb 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.
“嘿,Windows 开发人员朋友们!
要让您的服务器顺利启动并运行,请按照以下简单步骤操作:
gem install psych
bundle install
rails s
就是这样!您的服务器很快就会愉快地运行。快乐编码!”