【问题标题】:Issues serving Jekyll to localhost, eventmachine 1.2.7 has an error when installing将 Jekyll 服务到 localhost 时出现问题,eventmachine 1.2.7 安装时出错
【发布时间】:2021-03-12 12:00:12
【问题描述】:

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

bundle exec jekyll serve

有人告诉我:

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

然后我:

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

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

【问题讨论】:

    标签: ruby rubygems jekyll bundle eventmachine


    【解决方案1】:

    试试吧:

    gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
    

    【讨论】:

      【解决方案2】:

      我在 Big Sur 上遇到了同样的问题,这个解决方案效果很好:

      How to fix Jekyll after upgrading to MacOS 11 (Big Sur)

      下载 XCODE 12 beta from here 并将其复制到 Applications 文件夹。

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

      git clone https://github.com/rbenv/rbenv.git ~/.rbenv
      
      cd ~/.rbenv && src/configure && make -C src
      

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

      xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
      

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

      【讨论】:

        【解决方案3】:

        我不必构建 ruby​​ 或安装 XCode。 Jekyll requires Ruby 2.4.0 或更高版本和 Big Sur 附带 2.6.3,我 followed Jekyll's instructions 安装最新版本的 Ruby。

        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
        brew install ruby
        

        将 Ruby 添加到 .bash_profile 中的 shell 配置中。

        PATH="/usr/local/opt/ruby/bin:$PATH"
        export PATH
        

        安装捆绑器。我不得不从 4.0 升级到 Jekyll 4.2,并使用 Ruby 3.0 安装 no longer a default gem 的 webrick。如果 Jekyll 是全局安装的,那么还要安装它、webrick 和任何其他 gem,比如 jekyll-paginate。

        gem install --user-install bundler jekyll
        

        将 gems 路径添加到 .bash_profile 中的 shell 配置,将 X.X 替换为 Ruby 版本的前两位数。

        PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"
        export PATH
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2011-10-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-04-04
          • 1970-01-01
          • 2011-06-01
          相关资源
          最近更新 更多