gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 12:44:03 24 4
gpt4 key购买 nike

摘要

  • 我想在本地机器上看到一个由 Jekyll 使用 gem "jekyll-remote-theme"
  • 创建的页面
  • 所以我运行了bundle exec jekyll serve
  • 但是出来的是空白页

我想要实现的目标

  • 使用 gem "jekyll-remote-theme" 在本地机器上查看由 Jekyll 制作的页面。

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

环境

  • 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 Method 安装主题
  3. bundle exec jekyll serve

实际发生了什么

我有一个与 libcurl.dll 相关的错误。这是 Powershell 上的消息。

Dependency Error: Yikes! It looks like you don't have jekyll-remote-theme or o ne of its dependencies installed. In order to use Jekyll as currently configured , you'll need to install this gem. The full error message from Ruby is: 'Could n ot open library 'libcurl': (illegal characters) . Could not open libr ary 'libcurl.dll': (illegal characters) . Could not open library 'lib curl.so.4': (illegal characters) . Could not open library 'libcurl.so .4.dll': (illegal characters) ' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!

我按照 GitHub Pages Dependencies Missing · Issue #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.

看起来 jekyll 无法读取布局文件。此外,_layouts 目录不在我执行 bundle exec jekyll new 的目录中。但默认情况下,what's in the _layouts directory is packaged in a theme所以看不到目录是正常的。所以我只是从 minimal-mistakes GitHub repo 复制了 _layouts到本地目录作为解决方法。

然后,出现了另一个错误。

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.

我本可以用同样的方式复制 _includes 但我相信问题的核心在于 jekyll 未能从中读取必要的文件,例如, GitHub 存储库

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

enter image description here

顺便说一下,repo 是 https://github.com/Dixhom/dixhom.github.io/tree/7132905f5515345eb78cd71bdad168a15f906a1c

我怀疑 jekyll-remote-theme 在本地环境中不起作用,所以我用谷歌搜索“jekyll remote theme serve”,但没有帮助。

谷歌搜索关键字,如“远程主题构建警告:布局不存在”。没有太大帮助。

我该如何解决这个问题?

最佳答案

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

# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
end

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

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

希望对您有所帮助!

关于ruby - Jekyll 远程主题在本地不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48728510/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com