fsq*_*rel 4 jekyll github-pages
我正在尝试在 macOS 上本地运行一个基本的 GitHub 页面。
这是我的 Gemfile:
$cat Gemfile
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
Run Code Online (Sandbox Code Playgroud)
然后我安装依赖项:
$bundle install --path vendor/bundle
Run Code Online (Sandbox Code Playgroud)
结果,它安装了 Jekyll 3.8.5。但是,当我使用该网站构建网站时,bundle exec jekyll build --verbose
出现下一个错误:
Logging at level: debug
Configuration file: /Users/user/personal/my_user_name.github.io/_config.yml
Theme: jekyll-theme-midnight
Theme source: /Users/user/personal/my_user_name.github.io/vendor/bundle/ruby/2.6.0/gems/jekyll-theme-midnight-0.1.1
Invalid theme folder: _includes
GitHub Pages: github-pages v203
GitHub Pages: jekyll v3.8.5
Theme: jekyll-theme-midnight
Theme source: /Users/user/personal/my_user_name.github.io/vendor/bundle/ruby/2.6.0/gems/jekyll-theme-midnight-0.1.1
Invalid theme folder: _includes
Requiring: jekyll-seo-tag
Requiring: jekyll-coffeescript
Requiring: jekyll-commonmark-ghpages
Requiring: jekyll-gist
jekyll 3.8.5 | Error: uninitialized constant Faraday::Error::ClientError
Did you mean? Faraday::ClientError
Run Code Online (Sandbox Code Playgroud)
我的机器详细信息:
$sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
PS如果我从头开始创建一个jekyll目录
$jekyll new myblog
$cd myblog
$jekyll serve
Run Code Online (Sandbox Code Playgroud)
它运行正确。我看到的唯一区别是它使用 Jekyll 4.0.0
更新:我已将 Gemfile 更改为:
$cat Gemfile
source 'https://rubygems.org'
#gem 'github-pages', group: :jekyll_plugins
gem 'github-pages'
Run Code Online (Sandbox Code Playgroud)
运行后bundle exec jekyll serve --verbose
我看到:
Logging at level: debug
Configuration file: /Users/user/personal/my_user_name.github.io/_config.yml
Logging at level: debug
Theme: jekyll-theme-midnight
Theme source: /Users/user/personal/my_user_name.github.io/vendor/bundle/ruby/2.6.0/gems/jekyll-theme-midnight-0.1.1
Invalid theme folder: _includes
Requiring: jekyll-seo-tag
Source: /Users/user/personal/my_user_name.github.io
Destination: /Users/user/personal/my_user_name.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
EntryFilter: excluded /Gemfile
EntryFilter: excluded /Gemfile.lock
EntryFilter: excluded /vendor/bundle/ruby
Rendering: assets/css/style.scss
Pre-Render Hooks: assets/css/style.scss
Rendering Markup: assets/css/style.scss
Writing: /Users/user/personal/my_user_name.github.io/_site/assets/css/style.css
done in 0.099 seconds.
Requiring: jekyll-watch
Watcher: Ignoring (?-mix:^_config\.yml)
Watcher: Ignoring (?-mix:^_site\/)
Watcher: Ignoring (?-mix:^Gemfile)
Watcher: Ignoring (?-mix:^Gemfile\.lock)
Watcher: Ignoring (?-mix:^vendor\/bundle\/)
Auto-regeneration: enabled for '/Users/user/personal/my_user_name.github.io'
[2020-01-01 17:52:58] INFO WEBrick 1.4.2
[2020-01-01 17:52:58] INFO ruby 2.6.5 (2019-10-01) [x86_64-darwin19]
[2020-01-01 17:52:58] DEBUG WEBrick::HTTPServlet::FileHandler is mounted on /.
[2020-01-01 17:52:58] DEBUG unmount .
[2020-01-01 17:52:58] DEBUG Jekyll::Commands::Serve::Servlet is mounted on .
Server address: http://127.0.0.1:4000
[2020-01-01 17:52:58] INFO WEBrick::HTTPServer#start: pid=65841 port=4000
Server running... press ctrl-c to stop.
[2020-01-01 17:53:27] DEBUG accept: 127.0.0.1:53546
[2020-01-01 17:53:27] DEBUG accept: 127.0.0.1:53547
[2020-01-01 17:53:27] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2020-01-01 17:53:30] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2020-01-01 17:53:31] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2020-01-01 17:53:34] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2020-01-01 17:53:35] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2020-01-01 17:53:42] DEBUG close: 127.0.0.1:53547
^C[2020-01-01 17:53:55] DEBUG close TCPSocket(127.0.0.1, 4000)
[2020-01-01 17:53:55] INFO going to shutdown ...
[2020-01-01 17:53:56] DEBUG close: 127.0.0.1:53546
[2020-01-01 17:53:56] INFO WEBrick::HTTPServer#start done.
Run Code Online (Sandbox Code Playgroud)
但是当我在浏览器中打开它时,我只看到一个目录列表而不是博客
小智 5
它看起来是由于法拉第的最新更新 - github-pages 依赖的 gem。
暂时尝试此解决方法。
将以下行添加到您的 Gemfile 中。
宝石'法拉第','~> 0'
使用命令bundle update
用 Gemfile 更新 gem(s)。
您可能会在下面看到输出:
获取法拉第 0.17.3(原为 1.0.0)
安装法拉第 0.17.3(原为 1.0.0)
这意味着 ./vendor/bundle 中的 gem faraday 已更新为与 github-pages 兼容的最新版本。
您可以在 rubygems.org上的此页面上查看法拉第的版本历史记录。
再试bundle exec jekyll
一次。
如果它还不起作用,请尝试bundle pristine
。