【问题标题】:Jekyll won't build if gemfile exists如果 gemfile 存在,Jekyll 将不会构建
【发布时间】:2016-05-12 16:14:44
【问题描述】:

我正在开发我的 Github Pages 站点,因此需要在我的本地计算机上构建它。 Following their instructions,我已经使用捆绑器进行了设置。然而,bundler 似乎破坏了 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>'

我的宝石文件:

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

Jekyll 版本:3.0.5

【问题讨论】:

  • 你能发布一个带有跟踪bundle exec jekyll serve --trace的错误吗?
  • @DavidJacquel 完成

标签: github bundler jekyll github-pages


【解决方案1】:

这是jekyll-github-metadata gem,当您尝试在您的系统 (code) 上运行 git remote --verbose 命令时出现问题。

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

repository: username/repo-name

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-01
    • 2016-03-13
    • 1970-01-01
    相关资源
    最近更新 更多