【问题标题】:Error upon `bundle exec jekyll 3.8.7 new .` for Github PagesGithub页面的`bundle exec jekyll 3.8.7 new .`出错
【发布时间】:2020-06-10 22:49:18
【问题描述】:

目标

使用 Jekyll 启动 Github 页面。我正在关注Github Pages docs

问题

执行时:

bundle exec jekyll 3.8.7 new .

返回如下错误:

fatal: 'jekyll 3.8.7' could not be found. You may need to install the jekyll-3.8.7 gem or a related gem to be able to use this subcommand..

还要注意 (a) Jekyll 3.8.7 是 current dependency version for Github Pages 和 (b) 如果我尝试 Jekyll 4.1.0 会返回相同的错误。

上下文

我尝试了this SO post 中的建议——$ bundle init$ bundle add jekyll——但这并没有解决我的问题。

系统详情:

$ which ruby
/Users/vishrutarya/.rbenv/shims/ruby

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]

$ jekyll -v
jekyll 4.1.0

$ which jekyll
/Users/vishrutarya/.gem/ruby/2.7.0/bin/jekyll

【问题讨论】:

    标签: ruby jekyll bundler github-pages


    【解决方案1】:

    对我来说,添加下划线就可以了。 我手动安装了 3.8.7 版。使用gem list,您可以检查它是否是 实际安装。 然后我使用了bundle exec jekyll _3.8.7_ new . --force,它成功了。

    【讨论】:

    • 对我来说,也是下划线使它起作用,但我找不到下划线对这个命令的实际含义/作用。
    【解决方案2】:

    在 MacOS 上遇到了同样的问题。这就是我最终要做的:

    1. 创建一个新目录,我们称之为blog
    2. 运行bundle init
    3. 在 Gemfile 中,添加行 gem "jekyll", "= 3.8.7"
    4. 运行bundle i
    5. 您可以通过发出bundle exec jekyll -v 来验证 jekyll 版本
    6. 在同一文件夹下创建docs/目录
    7. 运行bundle exec jekyll new .
    8. docs/目录中再次运行bundle i
    9. 要提供服务,请在 docs/ 目录中运行 bundle exec jekyll serve

    我希望这会有所帮助!

    【讨论】:

    • 第 5 步抛出错误:zsh: command not found: jekyll。如果我通过gem install --user-install bundler jekyll 安装,为什么会发生这种情况?该命令的输出在下一条评论中。
    • ``` 获取 bundler-2.1.4.gem 警告:您的 PATH 中没有 /Users/vishrutarya/.gem/ruby/2.7.0/bin,gem 可执行文件将无法运行.成功安装了 bundler-2.1.4 解析 bundler-2.1.4 的文档 2 秒后完成了 bundler 的安装文档 获取 jekyll-4.1.0.gem 成功安装了 jekyll-4.1.0 解析了 jekyll-4.1.0 的文档 完成了安装文档0 秒后 jekyll 安装了 2 个 gem ``` 问题是“你的路径中没有 /Users/vishrutarya/.gem/ruby/2.7.0/bin”?
    • 对于第 5 步:如果您的系统和项目使用不同的 Jekyll gem,那么要获取项目的 Jekyll 版本,请执行命令 bundle exec jekyll -v --> 这将返回 jekyll 3.8.7 以及一些警告
    • @dkb 这更有意义,我已经更新了我的答案。谢谢!
    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 2021-08-31
    • 2017-11-12
    • 2021-08-11
    • 2018-04-01
    • 1970-01-01
    • 2013-06-26
    相关资源
    最近更新 更多