Jekyll远程主题在本地不起作用

dix*_*hom 9 ruby windows github jekyll github-pages

抽象

  • 我想在Jekyll使用的本地机器中看到一个页面 gem "jekyll-remote-theme"
  • 所以我跑了 bundle exec jekyll serve
  • 但是出现了一个空白页面

我想要实现的目标

  • 要查看Jekyll使用的本地计算机中的页面gem "jekyll-remote-theme".

我正在尝试使用Jekyll和Minimal Mistakes在GitHub页面中构建一个博客.在我推动更改之前,我想检查页面是否一切正常.

环境

  • Windows 8.1 64位
  • ruby 2.4.3p205(2017-12-14修订版61247)[x64-mingw32]
  • 杰基尔3.6.2

我做了什么

  1. bundle exec jekyll new . --force
  2. 使用GitHub Pages方法安装主题
  3. bundle exec jekyll serve

实际发生了什么

我有一个与之相关的错误libcurl.dll.以下是Powershell上的消息.

依赖性错误:哎呀!看起来您没有安装jekyll-remote-theme或其依赖项.为了使用当前配置的Jekyll,您需要安装此gem.来自Ruby的完整错误消息是:'无法打开库'libcurl':(非法字符).无法打开libr ary'libcurl.dll':(非法字符).无法打开库'lib curl.so.4':(非法字符).无法打开库'libcurl.so .4.dll':(非法字符)'如果遇到麻烦,可以在https://jekyllrb.com/help/找到有用的资源!

我按照GitHub页面依赖关系中的说明缺失·问题#17·benbalter/jekyll-remote-theme,问题解决了.

然后出现了另一个错误bundle exec jekyll serve.本地创建的页面为空白.http://127.0.0.1:4000/什么也没说.

PS E:\workspace\mysite\dixhom.github.io> bundle exec jekyll serve
Configuration file: E:/workspace/mysite/dixhom.github.io/_config.yml
            Source: E:/workspace/mysite/dixhom.github.io
       Destination: E:/workspace/mysite/dixhom.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
      Remote Theme: Using theme mmistakes/minimal-mistakes
     Build Warning: Layout 'single' requested in _posts/2018-02-06-welcome-to-jekyll.markdown does not exist.
     Build Warning: Layout 'default' requested in 404.html does not exist.
     Build Warning: Layout 'page' requested in about.md.bak does not exist.
     Build Warning: Layout 'home' requested in index.html does not exist.
     Build Warning: Layout 'home' requested in index.md.bak does not exist.
                    done in 5.423 seconds.
 Auto-regeneration: enabled for 'E:/workspace/mysite/dixhom.github.io'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
Run Code Online (Sandbox Code Playgroud)

它看起来像jekyll无法读取布局文件.另外,_layouts目录不在我所做的目录中bundle exec jekyll new.但默认情况下,是什么在_layouts目录被包装在一个主题所以这是正常的不是看目录.所以我只是_layouts最小错误GitHub repo复制到本地目录作为一种解决方法.

然后,又出现了另一个错误.

PS E:\workspace\mysite\dixhom.github.io> bundle exec jekyll serve
Configuration file: E:/workspace/mysite/dixhom.github.io/_config.yml
            Source: E:/workspace/mysite/dixhom.github.io
       Destination: E:/workspace/mysite/dixhom.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
      Remote Theme: Using theme mmistakes/minimal-mistakes
  Liquid Exception: Could not locate the included file 'sidebar.html' in any of ["E:/workspace/mysite/dixhom.github.io/_
includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site sourc
e. in /_layouts/single.html
jekyll 3.6.2 | Error:  Could not locate the included file 'sidebar.html' in any of ["E:/workspace/mysite/dixhom.github.i
o/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site so
urce.
Run Code Online (Sandbox Code Playgroud)

我本可以_includes以同样的方式复制,但我相信问题的核心在于jekyll无法从GitHub仓库中读取必要的文件.

奇怪的是当我将本地更改推送到GitHub时,GitHub Pages显示正确呈现的页面,如下所示.

在此输入图像描述

顺便说一句,回购是https://github.com/Dixhom/dixhom.github.io/tree/7132905f5515345eb78cd71bdad168a15f906a1c

我怀疑jekyll-remote-theme不能在当地的环境下工作所以我用Google搜索"jekyll远程主题服务",这是没有用的.

谷歌搜索关键字,如"远程主题生成警告:布局不存在".没多大帮助.

我怎么解决这个问题?

小智 10

啊啊啊我也只是在反对这个。我跑了bundle exec jekyll serve --verbose,看到它jekyll-remote-theme根本没有被初始化(每个插件都记录Requiring: jekyll-<thing>一行)。然后我注意到 Gemfile 中的这个块:

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end
Run Code Online (Sandbox Code Playgroud)

我添加"gem jekyll-remote-theme"到那个插件块并修复了它 - 哦!

jekyll 更新日志中有一些关于这个 Gemfile 组的注释,但我没有发现其中的任何内容对解释这里发生的事情很有帮助。

希望有帮助!