找不到Jekyll主题 [英] Jekyll theme could not be found

查看:91
本文介绍了找不到Jekyll主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的jekyll文档之后: https://jekyllrb.com/docs/themes/我试图安装和更改基于gem的主题,因此为此选择了jekyll-theme-primer,并运行了以下命令,并根据

Following the jekyll documentation found here: https://jekyllrb.com/docs/themes/ I was trying to install and change a gem based theme so I have chosen the jekyll-theme-primer for this and I've run the following command and instructed under the https://jekyllrb.com/docs/themes/#installing-a-theme section:

gem "jekyll-theme-primer"

并收到此错误:

ERROR:  While executing gem ... (Gem::CommandLineError)
    Unknown command jekyll-theme-awesome

做完一些研究后,我发现我应该按如下说明在查询中添加 install :

After doing some research I've found that I should have added install to my query as described here: While executing gem, unknown command

运行此命令后:

gem install "jekyll-theme-primer"

我成功安装了基于入门级gem的主题,并得到以下确认:

I successfully installed the primer gem based theme and got the following confirmation:

Successfully installed jekyll-theme-primer-0.5.2
Parsing documentation for jekyll-theme-primer-0.5.2
Done installing documentation for jekyll-theme-primer after 0 seconds
1 gem installed

第一个问题:官方文档不正确还是我遗漏了一些东西?

First question: Was the official documentation incorrect or am I missing something?

我继续运行bundle install命令:

I proceeded to run the bundle install command:

bundle install

并通过添加/替换以下行,用jekyll-theme-primer替换了_config.yml中我当前的最小主题:

and replaced my current minima theme from the _config.yml with the jekyll-theme-primer by adding/replacing this line:

theme: jekyll-theme-primer

现在,当我尝试运行以下任一程序时:

Now when I tried to run either the:

jekyll serve

或:

bundle exec jekyll serve

命令,出现以下错误:

jekyll 3.5.2 | Error:  The jekyll-theme-primer theme could not be found.

那么,如果安装成功,为什么找不到gem主题呢?

So why it can't find the gem theme if the installation was successful?

推荐答案

从我的收集来看,您似乎没有将jekyll-theme-primer添加到Gemfile中,而是只是在终端中稍后执行了gem "jekyll-theme-primer"遇到Gem::CommandLineError

From what I gather, it looks like you did not add jekyll-theme-primer to your Gemfile, but instead simply executed gem "jekyll-theme-primer" in the terminal and later installed the gem correctly after encountering the Gem::CommandLineError

因此,简而言之,只需执行以下步骤:

So, in short, simply follow the steps below:

  • 将主题宝石添加到您的Gemfile
  • 将主题添加到您的_config.yml(已正确完成.)
  • 运行:bundle install(只是为了确保Bundler能够使用它)
  • 运行:bundle exec jekyll serve
  • Add the theme-gem to your Gemfile
  • add the theme to your _config.yml (correctly done already..)
  • Run: bundle install (just to make sure Bundler is able to use it)
  • Run: bundle exec jekyll serve

在文本编辑器中打开当前的Gemfile,并用主题gem 替换整行 gem "minima", "~> 2.0".即gem "jekyll-theme-primer", "~> 0.4"

Open your current Gemfile in a text-editor, and replace entire line gem "minima", "~> 2.0" with your theme gem. i.e. gem "jekyll-theme-primer", "~> 0.4"

这篇关于找不到Jekyll主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆