向本地主机提供 Jekyll 服务时出现问题,eventmachine 1.2.7 安装时出现错误

tim*_*ver 13 ruby bundle rubygems eventmachine jekyll

不知道该怎么做才能具体解决这个问题,谷歌搜索并没有解决我的问题。当我尝试:

bundle exec jekyll serve

我被告知:

Could not find eventmachine-1.2.7 in any of the sources
Run `bundle install` to install missing gems.

Run Code Online (Sandbox Code Playgroud)

然后我:

bundle install

只是为了得到这个:

Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /private/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/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
./siteconf20201130-34411-pd54nh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7 for
inspection.
Results logged to
/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/extensions/universal-darwin-20/2.6.0/eventmachine-1.2.7/gem_make.out

An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  minima was resolved to 2.5.1, which depends on
    jekyll-feed was resolved to 0.13.0, which depends on
      jekyll was resolved to 4.0.0, which depends on
        em-websocket was resolved to 0.5.1, which depends on
          eventmachine

Run Code Online (Sandbox Code Playgroud)

我这里哪里出错了?刚刚更新到 macOS 11.0.1,这是更新后我第一次尝试为 jekyll 提供服务。谢谢大家!

小智 17

你试一试:

gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
Run Code Online (Sandbox Code Playgroud)


小智 3

我在 Big Sur 上遇到了同样的问题,这个解决方案非常有效:

升级到 MacOS 11 (Big Sur) 后如何修复 Jekyll

从此处下载 XCODE 12 beta并将其复制到应用程序文件夹。

然后按照以下步骤安装rbenv。

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Run Code Online (Sandbox Code Playgroud)
cd ~/.rbenv && src/configure && make -C src
Run Code Online (Sandbox Code Playgroud)

添加~/.rbenv/bin到您的 $PATH 以访问 rbenv 命令行实用程序。请参阅: https: //github.com/rbenv/rbenv#basic-github-checkout

xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)

现在,在 Jekyll 项目的根目录中,您应该能够运行bundle install,并且它应该安装所有缺少的依赖项并且现在应该可以工作。