说明
我正试图使用Jekyll 3.8.5在GitHub Pages上建立我的个人网站,具体内容如下。https:/help.github.comengithubworking-with-github-pagescreating-a-github-pages-sit-with-jekyll。但有一个捆绑器的问题。
详见
Bundle找不到已安装的Jekyll 3.8.5。
$ bundle exec jekyll 3.8.5 new .
fatal: 'jekyll 3.8.5' could not be found. You may need to install the jekyll-3.8.5 gem or a related gem to be able to use this subcommand.`
验证我是否真的有jekyll-3.8.5。
$ bundle info jekyll
* jekyll (3.8.5)
Summary: A simple, blog aware, static site generator.
Homepage: https://github.com/jekyll/jekyll
Path: /Users/macikportali/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/jekyll-3.8.5
Gemfile (安装了 bundle install
)
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.0.0"
# gem "jekyll", "~> 3.8.5"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
gem "jekyll-athena"
# Seems this is needed to install a lot of subcommands, see: https://github.com/jekyll/jekyll-compose
gem 'jekyll-compose', group: [:jekyll_plugins]
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# for jekyll 3.8.5
gem "github-pages", "204", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.11"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
Jekyll与垫片一起使用
$ which jekyll
/Users/macikportali/.rbenv/shims/jekyll
我当前的rbenv版本
$ rbenv version
2.7.1 (set by /Users/macikportali/.rbenv/version)
问题
为什么bundler看不到安装的jekyll-3.8.5 gem?
好吧,我想我明白了。我的Jekyll有两个不同的版本。
$ gem list jekyll
*** LOCAL GEMS ***
jekyll (4.0.1, 3.8.5)
我所做的是在版本中添加下划线(_)作为前缀和后缀,因此,执行了以下命令
bundle exec jekyll _3.8.5_ new docs
这就解决了问题,因为我相信这是gem在你有不同版本时遵循的惯例。
现在,我有一个不同的问题,就是有404页面,但这是另一个问题要处理。