Jekyll服务常见问题

2018/12/11 Jekyll 共 3582 字,约 11 分钟
似水似流年

命令详解:

  • Jekyll build
    • 构建网站,本地生成_site文件夹,里面包含具体html页面信息。
  • bundle exec jekyll serve
    • 本地启动服务。
  • gem list bundle
    • 查看本地的bundle信息。

问题汇总:

  • **/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/ke**
    • 原因:未指定ruby的真实路径
    • 方案:配置profile文件指定目录
      #ruby2.7.0
      export PATH="/usr/local/opt/ruby/bin:$PATH"
      export LDFLAGS="-L/usr/local/opt/ruby/lib"
      export CPPFLAGS="-I/usr/local/opt/ruby/include"
      export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
    
  • 提示版本问题:

    • 主要是修改目录下的Gemfile.lock文件,确保文件内的版本号 和 本地环境的版本一致
  • warning: Using the last argument as keyword parameters is deprecated
    • 警告类信息
  • client.rb:79:in `rescue in savefrom errors’: uninitialized constant Faraday::Error::ConnectionFailed (NameError)

  • The GitHub API credentials you provided aren’t valid

    • 原因:自己的github授权的token失效了

    • 方案:github自己重新生成再授权。

    • 实操:

        export JEKYLL_GITHUB_TOKEN=github_pat_token
              
        bundle exec jekyll serve
      
      • 再次jekyll build 可以解决此类问题
  • Gem bundler-2.1.2 cannot be uninstalled because it is a default gem

    • 原因:bundler的版本太低了
    • 方案:升级bundler的版本
    • 实操:
      gem install --default bundler
      gem update --system
      bundle update --bundler
    
  • GitHub Metadata: Error processing value ‘{anonymous}’: Liquid Exception: uninitialized constant Faraday::Error::ConnectionFailed Did you mean? Faraday::ConnectionFailed in /_layouts/page.html
    • 原因:bundler环境问题
    • 方案:卸载Jekyll 重新安装
    • 实操:
      • 卸载:
        • gem uninstall jekyll
      • gem源配置国内的
      • 重新安装:
        • gem install jekyll
        • bundle install
      • Gemfile.lock 要修改成对应jekyll版本、bundle版本
      • GIthub APi问题:
        • 配置自己的token:export JEKYLL_GITHUB_TOKEN=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
      • 服务启动:
        • bundle exec jekyll serve
  • /Library/Ruby/Gems/2.6.0/gems/bundler-2.4.1/lib/bundler/definition.rb:523:in materialize': Could not find github-pages-172, github-pages-health-check-1.3.5, jekyll-3.6.2, jekyll-avatar-0.5.0, jekyll-commonmark-ghpages-0.1.3, jekyll-default-layout-0.1.4, jekyll-feed-0.9.2, jekyll-github-metadata-2.9.3, jekyll-mentions-1.2.0, jekyll-optional-front-matter-0.3.0, jekyll-readme-index-0.2.0, jekyll-redirect-from-0.12.1, jekyll-relative-links-0.5.2, jekyll-remote-theme-0.2.3, jekyll-sass-converter-1.5.0, jekyll-seo-tag-2.3.0, jekyll-sitemap-1.1.1, jekyll-theme-architect-0.1.0, jekyll-theme-cayman-0.1.0, jekyll-theme-dinky-0.1.0, jekyll-theme-hacker-0.1.0, jekyll-theme-leap-day-0.1.0, jekyll-theme-merlot-0.1.0, jekyll-theme-midnight-0.1.0, jekyll-theme-minimal-0.1.0, jekyll-theme-modernist-0.1.0, jekyll-theme-primer-0.5.2, jekyll-theme-slate-0.1.0, jekyll-theme-tactile-0.1.0, jekyll-theme-time-machine-0.1.0, jekyll-titles-from-headings-0.5.0, jemoji-0.8.1, listen-3.0.6, minima-2.1.1, typhoeus-0.8.0, jekyll-watch-1.5.1, jekyll-commonmark-1.1.0, sass-3.5.5, rb-inotify-0.9.10, ethon-0.11.0, sass-listen-4.0.0, ffi-1.9.18 in locally installed gems (Bundler::GemNotFound) from /Library/Ruby/Gems/2.6.0/gems/bundler-2.4.1/lib/bundler/definition.rb:186:in specs’ from /Library/Ruby/Gems/2.6.0/gems/bundler-2.4.1/lib/bundler/definition.rb:243:in specs_for' from /Library/Ruby/Gems/2.6.0/gems/bundler-2.4.1/lib/bundler/runtime.rb:18:in setup’ from /Library/Ruby/Gems/2.6.0/gems/bundler-2.4.1/lib/bundler.rb:170:in setup' from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.3.1/lib/jekyll/plugin_manager.rb:52:in require_from_bundler’ from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.3.1/exe/jekyll:11:in <top (required)>' from /usr/local/bin/jekyll:23:in load’ from /usr/local/bin/jekyll:23:in `<main>’
    • 原因:安装的bundle版本不对
    • 方案:重新安装Gem和bundle
    • 实操:
      • sudo gem install bundler:2.4.1
      • sudo bundle install
      • bundle exec jekyll server

文档信息

Search

    Table of Contents