Bundler:无法加载命令:jekyll(/usr/gem/bin/jekyll)

发布于 2025-02-10 03:30:06 字数 3650 浏览 1 评论 0原文

我正在尝试将我的jekyll网站部署到Codeberg页面。我正在使用一个叫做Woodpecker的CI。我

pipeline:
  publish:
    image: jekyll/jekyll
    secrets: [ codeberg_access_token ]
    commands:
      - bundle exec jekyll build
      - cd _site
      - git init
      - git remote add up $CODEBERG_ACCESS_TOKEN@https://codeberg.org/mikwee/pages.git
      - git push -u up master -f

悲伤地写了这条管道,当CI运行它时,我遇到了这个错误:

+ bundle exec jekyll build
bundler: failed to load command: jekyll (/usr/gem/bin/jekyll)
/usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:271:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'github-pages' in locally installed gems. (Bundler::GemNotFound)
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:254:in `map!'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:254:in `verify_gemfile_dependencies_are_found!'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:50:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:24:in `resolve'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:270:in `resolve'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:473:in `materialize'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:191:in `specs'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:239:in `specs_for'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/runtime.rb:18:in `setup'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler.rb:162:in `setup'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/setup.rb:20:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/ui/shell.rb:136:in `with_level'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/ui/shell.rb:88:in `silence'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:56:in `require_relative'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:56:in `kernel_load'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:23:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:483:in `exec'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:31:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
from /usr/local/bin/bundle:25:in `load'
from /usr/local/bin/bundle:25:in `<main>'

为什么会发生这种错误?谢谢。

I'm trying to deploy my Jekyll site to Codeberg Pages. I'm using a CI called Woodpecker. I wrote this pipeline

pipeline:
  publish:
    image: jekyll/jekyll
    secrets: [ codeberg_access_token ]
    commands:
      - bundle exec jekyll build
      - cd _site
      - git init
      - git remote add up $CODEBERG_ACCESS_TOKEN@https://codeberg.org/mikwee/pages.git
      - git push -u up master -f

Sadly, I got this error when the CI ran it:

+ bundle exec jekyll build
bundler: failed to load command: jekyll (/usr/gem/bin/jekyll)
/usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:271:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'github-pages' in locally installed gems. (Bundler::GemNotFound)
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:254:in `map!'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:254:in `verify_gemfile_dependencies_are_found!'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:50:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/resolver.rb:24:in `resolve'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:270:in `resolve'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:473:in `materialize'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:191:in `specs'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/definition.rb:239:in `specs_for'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/runtime.rb:18:in `setup'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler.rb:162:in `setup'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/setup.rb:20:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/ui/shell.rb:136:in `with_level'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/ui/shell.rb:88:in `silence'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:56:in `require_relative'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:56:in `kernel_load'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:23:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:483:in `exec'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:31:in `dispatch'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
from /usr/local/bin/bundle:25:in `load'
from /usr/local/bin/bundle:25:in `<main>'

Why is this happening? Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满地尘埃落定 2025-02-17 03:30:06

在我的情况下,强制使用Bundler版本2.2.x并使用bundle exec而不是直接与GEM相关的命令,请解决问题。

此外,您可以确保正在使用用于安装依赖项的相同版本的Bundler。让我们检查gemfile.lock文件的最后几行,例如:

...

BUNDLED WITH
   2.2.14

In my case forcing the usage of bundler version 2.2.x and using bundle exec instead of gem-related command directly, solved the issue.

Additionally, you can make sure that you're using the same version of bundler that has been used for installing dependencies. Let's check the last couple of lines of your Gemfile.lock file, e.g.:

...

BUNDLED WITH
   2.2.14
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文