【问题标题】:Jekyll gem breaks when adding Gemfile添加 Gemfile 时 Jekyll gem 中断
【发布时间】:2020-04-19 22:45:04
【问题描述】:

我在 jekyll 中有我的网站。一切正常,直到我做了一些事情(不确定是什么)并且安装失败了。

我已经在 Ubuntu WSL 和 Windows 原生 ruby​​ 上尝试过这个,问题是一样的。我可以很好地安装宝石。并且 jekyll 运行正常,但是如果我在其他目录中添加 gemfile 并再次运行 jekyll(bundle exec jekyll -v 甚至 jekyll -v 在该文件夹中),jekyll 运行良好,如果我删除 Gemfile,jekyll 也会运行。

错误是:

bundle exec jekyll -v
Traceback (most recent call last):
        23: from C:/tools/ruby26/bin/jekyll:23:in `<main>'
        22: from C:/tools/ruby26/bin/jekyll:23:in `load'
        21: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/exe/jekyll:11:in `<top (required)>'
        20: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
        19: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler.rb:174:in `require'
        18: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:58:in `require'
        17: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:58:in `each'
        16: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:69:in `block in require'         15: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:69:in `each'
        14: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
        13: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/bundler-2.1.2/lib/bundler/runtime.rb:74:in `require'
        12: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll-thumb.rb:1:in `<top (required)>'        11: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll-thumb.rb:1:in `require'
        10: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll/thumb.rb:2:in `<top (required)>'         9: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll/thumb.rb:2:in `require'
         8: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll/thumb/tag.rb:1:in `<top (required)>'
         7: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/jekyll-thumb-0.2.1/lib/jekyll/thumb/tag.rb:1:in `require'              6: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ruby-vips-2.0.16/lib/ruby-vips.rb:1:in `<top (required)>'              5: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ruby-vips-2.0.16/lib/ruby-vips.rb:1:in `require'
         4: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ruby-vips-2.0.16/lib/vips.rb:36:in `<top (required)>'
         3: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ruby-vips-2.0.16/lib/vips.rb:45:in `<module:GLib>'
         2: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ffi-1.11.3-x64-mingw32/lib/ffi/library.rb:99:in `ffi_lib'              1: from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/ffi-1.11.3-x64-mingw32/lib/ffi/library.rb:99:in `map'
block in ffi_lib: Could not  (LoadError) 'libglib-2.0-0.dll': Not found

(除了 libglib-2.0-0.so 之外,在 WSL 上完全一样)

我的 gemfile 是这样的:

source "https://rubygems.org"

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-paginate-v2"
  gem "jekyll-sitemap"
  gem "jekyll-org"
  gem "jekyll-thumb"
  gem "flickraw"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

根据我得出的结论,提供 Gemfile 时 jekyll 的版本(或它的依赖项)在某种程度上已损坏,但是当我查看捆绑程序的输出时,它是手动安装的全局 gem。我什至尝试将 libglib-2.0-0.dll 放入 system32 目录。

包的版本:

ruby: 2.6.5 [x64-mingw32]
bundler: 2.1.2
gem: 3.0.3
jekyll: 4.0.0

【问题讨论】:

    标签: ruby rubygems jekyll bundler


    【解决方案1】:

    您在 Gemfile 中运行的 Jekyll 版本存在问题。您在本地拥有的那个正在工作,所以这是您可以尝试的。 在 jekyll 失败的目录之外运行jekyll -v。将 Gemfile 中的版本替换为输出的版本和 bundle install

    我认为应该可以。

    编辑:您需要像这样将 jekyll gem 放入您的 Gemfile 中: gem "jekyll"

    否则你应该尝试安装libglib package it says is missing

    【讨论】:

    • 如您所见,我正在运行相同版本的 jekyll。我尝试将版本放入 Gemfile。 jekyll -v 输出 4.0.0 但在文件夹内它仍然失败
    • 你能看看我对答案所做的编辑吗?我认为他们可能是问题所在。
    • 不,问题仍然存在。至于我安装的库。在我的 Windows 和 ubuntu 上
    • Ruby ffi 需要能够找到共享库。在 WSL 下,它需要位于由 ldconfig 管理的 lib 区域之一,或者您需要将它所在的文件夹添加到 LD_LIBRARY_PATH。在 Windows 上,您需要将包含所有 libvips DLL 的文件夹添加到 RUBY_DLL_PATH
    猜你喜欢
    • 2013-10-16
    • 1970-01-01
    • 2019-09-18
    • 2020-01-17
    • 2015-05-07
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多