如果 gemfile 存在,Jekyll 将不会构建

Jekyll won't build if gemfile exists

我正在我的 Github 页面站点上工作,因此需要在我的本地计算机上构建它。 Following their instructions,我已经使用捆绑器进行了设置。然而,捆绑器似乎破坏了 Jekyll 构建。

如果我 运行 jekyll new NewSite 它会创建一个可以使用 jekyll serve 构建的新站点。然而,一旦我 运行 bundle installbundle update,Jekyll 拒绝 运行,在“生成”步骤中给出以下错误。

jekyll 3.0.5 | Error:  No such file or directory - git remote --verbose

然后每次调用 bundle exec jekyll servejekyll serve 时都会给出相同的错误。进一步调查发现,如果删除 gemfile 文件,错误就会消失。

我配置错了什么?

更新:

  1. 我已按要求添加堆栈跟踪
  2. 我意识到是 gemfile 本身导致了问题,而不是 gemfile.lock
  3. 问题原来与 Windows 无关,因此删除了对它的引用

堆栈跟踪:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:32
:in ``': No such file or directory - git remote --verbose (Errno::ENOENT)
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:32:in `git_remote_url'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:39:in `nwo_from_git_origin_remote'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:65:in `nwo'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:8:in `generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:154:in `block in generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:153:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:153:in `generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:58:in `process'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/command.rb:28:in `process_site'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/build.rb:60:in `build'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/build.rb:35:in `process'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/serve.rb:26:in `block (2 levels) in init_with_program'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/bin/jekyll:17:in `<top (required)>'
    from C:/Ruby22/bin/jekyll:23:in `load'
    from C:/Ruby22/bin/jekyll:23:in `<main>'

我的 Gemfile:

source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
gem 'safe_yaml', '~> 1.0.4'
gem 'wdm', '~> 0.1.0' if Gem.win_platform?

Ruby 版本:2.2.4 32 位

捆绑器版本:1.12.3

杰基尔版本:3.0.5

这是 jekyll-github-metadata gem,它在您的系统 (code) 上尝试 运行 一个 git remote --verbose 命令时出现错误。

您可以尝试设置一个 _config.yml 变量 (documentation) :

repository: username/repo-name