Jekyll 安装失败,并显示“extconf 失败,退出代码 1”在 Mac 操作系统上
我按照 https://jekyllrb.com/docs/installation/macos/ 中的说明进行操作最终遇到了这个错误。以下是我一路上遇到的其他一些事情。
xcode-select --install
xcode-select:错误:命令行工具已安装,请使用“软件更新”安装更新
export SDKROOT=$(xcrun --show-sdk-path)
刚刚转到终端中的新行,没有任何消息。看起来很成功。
Install Homebrew
(已安装)
brew install ruby
致命:无法将 HEAD 解析为修订版本 警告:没有名称为“ruby”的可用公式。 ==>正在搜索类似名称的公式... 发现了这些类似命名的公式: 自制软件/portable-ruby/portable-libyaml 自制软件/便携式红宝石/便携式ncurses 自制软件/便携式红宝石/便携式openssl 自制软件/便携式红宝石/便携式readline 自制软件/便携式红宝石/便携式红宝石 自制软件/portable-ruby/portable-zlib 要安装其中之一,请运行(例如): brew 安装 homebrew/portable-ruby/portable-libyaml ==>正在搜索以前删除的公式(上个月)... 错误:找不到以前删除的公式。 ==>正在 GitHub 上搜索 Taps... 错误:在水龙头中找不到公式。
# If you're using Zsh
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"' >> ~/.zshrc
刚刚转到终端中的新行,没有任何消息。看起来很成功。
退出并重新启动终端。
which ruby
/usr/bin/ruby
ruby -v
ruby 2.6.3p62(2019-04-16 修订版 67580)[universal.x86_64-darwin20]
gem install --user-install bundler jekyll
警告:您的 PATH 中没有 /Users/my-username/.gem/ruby/2.6.0/bin, gem 可执行文件将不会运行。成功安装bundler-2.3.9 解析bundler-2.3.9的文档 0 秒后完成捆绑程序的安装文档 构建本机扩展。这可能需要一段时间... 错误:安装 jekyll 时出错: 错误:无法构建 gem 本机扩展。
当前目录: /Users/我的用户名/.gem/ruby/2.6.0/gems/eventmachine-1.2.7/ext /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220321-36161-h5kjlp.rb extconf.rb 检查 -lcrypto... *** extconf.rb 失败 *** 由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件。 检查 mkmf.log 文件以获取更多详细信息。您可能需要配置 选项。
(省略一些配置信息)
<块引用>/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
try_do':编译器无法生成可执行文件。 (RuntimeError) 您必须先安装开发工具。来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in
block in try_link0' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:inmktmpdir' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in
try_link0' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:intry_link' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in
try_func' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:in /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in 中的 have_library' 中的块 checking_for' 中的块 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in阻止(2级)推迟'来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
open'从 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in阻止推迟'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
打开'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in推迟'来自 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
checking_for' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:in 来自 extconf.rb:8:in 的have_library'
check_libs' 中的块 extconf.rb:8:在全部中?'来自 extconf.rb:8:in
check_libs' 来自 extconf.rb:95:in `'要了解此扩展无法编译的原因,请检查 mkmf.log 可以在这里找到:
省略文件路径)
Mac OS 11.6.3
I followed the instructions at https://jekyllrb.com/docs/installation/macos/ and ultimately ran into this error. Here are some other things I ran into along the way.
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
export SDKROOT=$(xcrun --show-sdk-path)
Just went to a new line in the terminal with no message. seemed successful.
Install Homebrew
(was already installed)
brew install ruby
fatal: Could not resolve HEAD to a revision
Warning: No available formula with the name "ruby".
==> Searching for similarly named formulae...
These similarly named formulae were found:
homebrew/portable-ruby/portable-libyaml
homebrew/portable-ruby/portable-ncurses
homebrew/portable-ruby/portable-openssl
homebrew/portable-ruby/portable-readline
homebrew/portable-ruby/portable-ruby
homebrew/portable-ruby/portable-zlib
To install one of them, run (for example):
brew install homebrew/portable-ruby/portable-libyaml
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
# If you're using Zsh
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"' >> ~/.zshrc
Just went to a new line in the terminal with no message. seemed successful.
Quit and relaunched Terminal.
which ruby
/usr/bin/ruby
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
gem install --user-install bundler jekyll
WARNING: You don't have /Users/my-username/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run. Successfully installed bundler-2.3.9
Parsing documentation for bundler-2.3.9
Done installing documentation for bundler after 0 seconds
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.current directory:
/Users/my-username/.gem/ruby/2.6.0/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0
-r ./siteconf20220321-36161-h5kjlp.rb extconf.rb checking for -lcrypto... *** 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.
(some info about configuration omitted)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in
block in try_link0' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:inmktmpdir' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in
try_link0' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:intry_link' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in
try_func' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:inblock in have_library' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in
block in checking_for' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:inblock (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
open' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:inblock in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
open' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:inpostpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
checking_for' from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:inhave_library' from extconf.rb:8:in
block in check_libs' from
extconf.rb:8:inall?' from extconf.rb:8:in
check_libs' from
extconf.rb:95:in `'To see why this extension failed to compile, please check the mkmf.log
which can be found here:
(file path omitted)
Mac OS 11.6.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论