【问题标题】:Git Bash Jekyll site could not be built无法构建 Git Bash Jekyll 站点
【发布时间】:2019-07-25 04:20:47
【问题描述】:

我对 github 页面和 jekyll 非常陌生,但我正在尝试使用它们启动我自己的个人网站,每次我尝试执行“$ bundle exec jekyll serve”时,它都会显示“配置文件:无”尽管本地目录中有一个 _config.yml 文件。除此之外,我还遇到了其他几个错误,使我无法查看我的工作(发布在下面)。有什么建议/解决方案吗? myWebsite 是父文件夹,jekyllRepo 是 _config.yml 文件和其他几个文件所在的 jekyll 存储库。

$ bundle exec jekyll serve
Configuration file: none
Source: C:/Users/Owner/myWebsite
Destination: C:/Users/Owner/myWebsite/_site
Incremental build: disabled. Enable with --incremental
  Generating...
 Build Warning: Layout 'post' requested in jekyllRepo/_posts/2019-03-03-welcome-to-jekyll.markdown does not exist.
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
GitHub Metadata: Error processing value 'title':
Liquid Exception: No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository. in /_layouts/default.html
         ERROR: YOUR SITE COULD NOT BE BUILT:
                ------------------------------------
                No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository.

【问题讨论】:

    标签: github command-line jekyll github-pages git-bash


    【解决方案1】:

    首先你应该确认你已经安装了 Jekyll 和 Bundler gems

    $ jekyll -v
    

    你应该看到

    jekyll 3.8.5 -- Jekyll is a blog-aware, static site generator in Ruby
    

    如果没有安装,请安装

    $ gem install jekyll bundler
    

    如果是安装,你只需要在你的网站根目录中使用 jekyll(不是 bundle 命令)命令

    $ jekyll serve
    $ jekyll build
    

    是的,我发现网站上的入门也有点令人困惑......

    【讨论】:

    • 奇怪的是,我的 jekyll 版本只有 3.7.4,但是即使在确保已下载该文件后,我仍然会出现相同的错误消息。
    • 我正在使用 git bash 并尝试使用 'bundle exec jekyll serve' 来预览我的网站
    • 你没有阅读我的帖子 :) 不要使用 'bundle' 只需使用 'jekyll' 它在 git bash 下对我有用。
    • 我很抱歉我错过了那部分。我最终让它工作了。配置文件的问题之一是它位于 jekyllRepo 文件夹而不是父文件夹中,所以基本上我只是将它拖放到父文件夹中并注册。我还有很多工作要做,但这是朝着正确方向迈出的一步。
    【解决方案2】:

    由于您没有提供指向您的存储库的链接,我将根据您的终端输出做出一些假设。 因此,这将是一个反复试验的答案。

    你可能有一个带有gem 'github-pages', group: :jekyll_plugins 的 Gemfile 或者它可能包含

    group :jekyll_plugins do
      gem 'github-pages'
    end
    

    无论哪种方式,将github-pages 移出:jekyll_plugins 组。也就是说,您应该只有一个简单的清单:

    source 'https://rubygems.org'
    
    gem 'github-pages'
    

    【讨论】:

    • 抱歉忘记添加存储库链接。 (github.com/eingram00/jekyllRepo)。我唯一的 gem 文件实际上位于 jekyll 存储库之外,并且位于我 PC 上的根网站文件夹中。我不太确定如何显示我的 PC 上的文件与存储库上的文件之间的差异。 (help.github.com/en/articles/…) 这是我用来设置网站的网站。
    • 就像我在答案中提到的,只需尝试删除 group: :jekyll_plugins 声明。 (在给定仓库的 Gemfile 中的第 18 行 github.com/eingram00/jekyllRepo/blob/… 上。)
    • 这绝对有帮助,我最终成功了。 _config.yml 文件的问题之一是它位于 jekyllRepo 文件夹中而不是父文件夹中,所以基本上我只是将它拖放到父文件夹中并注册。我还有很多工作要做,但这是朝着正确方向迈出的一步。
    猜你喜欢
    • 2012-10-20
    • 2019-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-26
    • 2020-01-25
    • 1970-01-01
    相关资源
    最近更新 更多