【问题标题】:How to run just jekyll on a specific folder in WIndows 10?I can run bundle exec jekyll如何在 Windows 10 中的特定文件夹上运行 jekyll?我可以运行 bundle exec jekyll
【发布时间】:2020-11-30 08:14:38
【问题描述】:

我刚刚在使用 ruby​​installer 更新 ruby​​ 后重新安装了 jekyll,然后运行 ​​gem install jekyll bundler,一切都安装好了。之后,当我在“我的目录”中运行 jekyll 时,我收到以下错误消息。如果我运行 bundle exec jekyll 一切都按预期工作。此外,如果我在不同的目录中运行 jekyll,它也可以正常运行。我也想在“我的目录”中运行 jekyll。怎么做 ? 以下是我收到的错误消息。

jekyll
Traceback (most recent call last):
        10: from C:/Ruby27-x64/bin/jekyll:23:in `<main>'
         9: from C:/Ruby27-x64/bin/jekyll:23:in `load'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/exe/jekyll:11:in `<top (required)>'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/plugin_manager.rb:52:in `require_from_bundler'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated mercenary 0.4.0, but your Gemfile requires mercenary 0.3.6. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

【问题讨论】:

    标签: rubygems jekyll


    【解决方案1】:

    当您收到诸如“您已经激活 $OLD_GEM,但您的 Gemfile 需要 $NEW_GEM”之类的错误时,它是在告诉您您安装的某些 gem 已经过时或与预期不同。您通常可以通过运行bundle update 来解决此问题。如果失败,请尝试删除您的 Gemfile.lock 文件并运行 bundle install

    另一个“解决方案”可能是别名 bundle exec jekyll build,但我不确定 Windows 是否有别名。

    【讨论】:

    • 您好,我尝试删除锁定文件并运行捆绑安装,但它显示相同的错误。
    • 你可以试试gem uninstall mercenary --version 0.4.0gem which mercenary 在 Windows 中工作吗?那应该返回图书馆的位置。我想知道你的 PATH 是否有旧的位置,因此有旧的宝石。 gem environment 应该为您提供有关您安装了哪些 gem 的更多详细信息。您可能需要根据您在 PATH 中找到的内容进行更改。
    • 当我运行 gem uninstall mercenary --version 0.4.0 时,我收到一条警告说 jekyll-4.1.1 依赖它。如果我尝试卸载 jekyll-4.1.1 然后 mercenary 0.4.0,那么我可以再次运行 jekyll。我想我现在坚持使用这个(4.0.1)版本。
    • 如果是我,此时我会删除/卸载 Ruby 并从头开始。您可能会弄清楚这一点,但不值得花时间。全新安装后,您可以在一小时内完美运行。但是为了完整性/后代,您可以卸载 gem,不管它们的警告如何。当您运行 bundle install 时,它将添加回任何依赖项。根据您所说的,这让我想知道您的 Gemfile 中有什么。通过在 Jekyll Forums 或一些 Ruby 特定论坛中提问,您可能会获得更好的排序。
    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 1970-01-01
    • 2018-11-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多