bundle exec jekyll serve: 无法加载此类文件
bundle exec jekyll serve: cannot load such file
我正在尝试为 Github Page/Jekyll 网站做贡献,并希望能够在本地可视化更改,但是当我 运行 bundle exec jekyll serve
但我得到了这个输出:
bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll)
/usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `require': cannot load such file -- rexml/parsers/baseparser (LoadError)
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `<class:Kramdown>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:60:in `<module:Parser>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:19:in `<module:Kramdown>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:17:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll/converters/smartypants.rb:3:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll/converters/smartypants.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:13:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:13:in `block in require_all'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:12:in `each'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:12:in `require_all'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:194:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/exe/jekyll:8:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/exe/jekyll:8:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `load'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:63:in `load'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:28:in `run'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:494:in `exec'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:30:in `dispatch'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:24:in `start'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/exe/bundle:49:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/exe/bundle:37:in `<top (required)>'
from /usr/local/opt/ruby/bin/bundle:23:in `load'
from /usr/local/opt/ruby/bin/bundle:23:in `<main>'
我做了 bundle update
结果是这样的:
Using concurrent-ruby 1.1.8 (was 1.1.7)
Using multi_json 1.15.0
Using public_suffix 3.1.1
Using latex-decode 0.3.2
Using bundler 2.2.5
Using coffee-script-source 1.11.1
Using execjs 2.7.0
Using colorator 1.1.0
Using namae 1.0.2 (was 1.0.1)
Using unf_ext 0.0.7.7
Using http_parser.rb 0.6.0
Using faraday-net_http 1.0.1
Using multipart-post 2.1.1
Using ruby2_keywords 0.0.4
Using forwardable-extended 2.6.0
Using gemoji 3.0.1
Using rb-fsevent 0.10.4
Using kramdown 1.17.0
Using liquid 4.0.3
Using mercenary 0.3.6
Using rouge 3.13.0
Using safe_yaml 1.0.5
Using racc 1.5.2
Using jekyll-paginate 1.1.0
Using rubyzip 2.3.0
Using jekyll-swiss 1.0.0
Using unicode-display_width 1.7.0
Using i18n 0.9.5
Using coffee-script 2.4.1
Using citeproc 1.0.10
Using csl 1.5.2
Using unf 0.1.4
Using eventmachine 1.2.7
Using citeproc-ruby 1.1.13 (was 1.1.12)
Using activesupport 3.2.22.5
Using csl-styles 1.0.1.10
Using simpleidn 0.2.1 (was 0.1.1)
Using faraday 1.3.0 (was 1.0.1)
Using addressable 2.7.0
Using pathutil 0.16.2
Using jekyll-coffeescript 1.1.1
Using nokogiri 1.11.1 (x86_64-darwin) (was 1.10.10)
Using terminal-table 1.8.0
Using bibtex-ruby 4.4.7
Using em-websocket 0.5.2
Using dnsruby 1.61.5 (was 1.61.4)
Using html-pipeline 2.14.0
Using ffi 1.14.2 (was 1.13.1)
Using sawyer 0.8.2
Using ethon 0.12.0
Fetching ruby-enum 0.9.0 (was 0.8.0)
Using typhoeus 1.4.0
Using octokit 4.20.0 (was 4.18.0)
Using rb-inotify 0.10.1
Using github-pages-health-check 1.16.1
Using sass-listen 4.0.0
Using listen 3.4.1 (was 3.2.1)
Using jekyll-gist 1.5.0
Using sass 3.7.4
Using jekyll-watch 2.2.1
Using jekyll-sass-converter 1.5.2
Using jekyll 3.8.5
Using jekyll-avatar 0.7.0
Using jekyll-github-metadata 2.13.0
Using jekyll-mentions 1.5.1
Using jekyll-optional-front-matter 0.3.2
Using jekyll-readme-index 0.3.0
Using jekyll-redirect-from 0.15.0
Using jekyll-relative-links 0.6.1
Using jekyll-remote-theme 0.4.1
Using jekyll-seo-tag 2.6.1
Using jekyll-sitemap 1.4.0
Using jekyll-titles-from-headings 0.5.3
Using jemoji 0.11.1
Using jekyll-scholar 5.16.0
Using jekyll-feed 0.13.0
Using jekyll-theme-cayman 0.1.1
Using jekyll-theme-dinky 0.1.1
Using jekyll-theme-hacker 0.1.1
Using jekyll-theme-leap-day 0.1.1
Using jekyll-theme-merlot 0.1.1
Using jekyll-default-layout 0.1.4
Using jekyll-theme-minimal 0.1.1
Using jekyll-theme-midnight 0.1.1
Using jekyll-theme-primer 0.5.4
Using jekyll-theme-slate 0.1.1
Using jekyll-theme-tactile 0.1.1
Using jekyll-theme-modernist 0.1.1
Using jekyll-theme-time-machine 0.1.1
Using minima 2.5.1
Using jekyll-theme-architect 0.1.1
Installing ruby-enum 0.9.0 (was 0.8.0)
Using commonmarker 0.17.13
Using jekyll-commonmark 1.3.1
Using jekyll-commonmark-ghpages 0.1.6
Using github-pages 204
Bundle updated!
此外,这就是 gemfile 的样子:
source "https://rubygems.org"
gem 'jekyll-scholar', group: :jekyll_plugins
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", "~> 204", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?
为什么不起作用?
我是 ruby 和 jekyll/github 页面的新手,但我创建了另一个 Github 页面的网站并且这个命令没有问题...
我遇到了同样的问题,我在 https://github.com/jekyll/jekyll/issues/8523
找到了解决方法
将 gem "webrick"
添加到您网站的 Gemfile 中。比运行bundle install
此时你可以运行bundle exec jekyll serve
对我来说很管用!
我看到您正在使用 github-pages:204
和 jekyll:3.8.5
。
我使我的项目具有相同的依赖关系:
bundle update github-pages
bundle add webrick
感谢@choas 的评论,这是我解决问题的方法:
- 更新了 github 页、jekyll 和 jekyll-feed gem,作者是 运行ning
gem install github-pages
、gem install jekyll
和 gem install jekyll-feed
。我必须执行此步骤,因为简单 bundle update
没有安装最新版本。
- 将Gemfile中的那些gems修改为最新版本。
- 运行
bundle update
- 终于运行
bundle exec jekyll serve
我不确定所有这些步骤是否都是多余的,因为我对 Ruby/Github Pages/Jekyll 不是很熟悉,但它确实有效。
- 安装 webrick 和 jekyll-mentions:打开终端并输入
gem install webrick
然后 gem install jekyll-mentions
.
- 打开你的gem文件并在插件中添加gem“jekyll-mentions”和gem“webrick”:
group :jekyll_plugins do
gem "jekyll-mentions", "1.6.0"
gem "webrick"
end
- 导航回终端,然后执行
bundle install
。
我想你可以走了。这个过程对我有用!
我也遇到这个错误。解决方案在 documentation itself.
If you are using Ruby version 3.0.0 or higher, step 5 may fail(bundle exec jekyll serve
). You may fix it by adding webrick
to your dependencies: bundle add webrick
或在Gemfile
中添加gem "webrick"
,然后bundle install
。
我正在尝试为 Github Page/Jekyll 网站做贡献,并希望能够在本地可视化更改,但是当我 运行 bundle exec jekyll serve
但我得到了这个输出:
bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll)
/usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `require': cannot load such file -- rexml/parsers/baseparser (LoadError)
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `<class:Kramdown>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:60:in `<module:Parser>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:19:in `<module:Kramdown>'
from /usr/local/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:17:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll/converters/smartypants.rb:3:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll/converters/smartypants.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:13:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:13:in `block in require_all'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:12:in `each'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:12:in `require_all'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/lib/jekyll.rb:194:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/exe/jekyll:8:in `require'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.8.5/exe/jekyll:8:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `load'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:63:in `load'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli/exec.rb:28:in `run'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:494:in `exec'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:30:in `dispatch'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/cli.rb:24:in `start'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/exe/bundle:49:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.5/exe/bundle:37:in `<top (required)>'
from /usr/local/opt/ruby/bin/bundle:23:in `load'
from /usr/local/opt/ruby/bin/bundle:23:in `<main>'
我做了 bundle update
结果是这样的:
Using concurrent-ruby 1.1.8 (was 1.1.7)
Using multi_json 1.15.0
Using public_suffix 3.1.1
Using latex-decode 0.3.2
Using bundler 2.2.5
Using coffee-script-source 1.11.1
Using execjs 2.7.0
Using colorator 1.1.0
Using namae 1.0.2 (was 1.0.1)
Using unf_ext 0.0.7.7
Using http_parser.rb 0.6.0
Using faraday-net_http 1.0.1
Using multipart-post 2.1.1
Using ruby2_keywords 0.0.4
Using forwardable-extended 2.6.0
Using gemoji 3.0.1
Using rb-fsevent 0.10.4
Using kramdown 1.17.0
Using liquid 4.0.3
Using mercenary 0.3.6
Using rouge 3.13.0
Using safe_yaml 1.0.5
Using racc 1.5.2
Using jekyll-paginate 1.1.0
Using rubyzip 2.3.0
Using jekyll-swiss 1.0.0
Using unicode-display_width 1.7.0
Using i18n 0.9.5
Using coffee-script 2.4.1
Using citeproc 1.0.10
Using csl 1.5.2
Using unf 0.1.4
Using eventmachine 1.2.7
Using citeproc-ruby 1.1.13 (was 1.1.12)
Using activesupport 3.2.22.5
Using csl-styles 1.0.1.10
Using simpleidn 0.2.1 (was 0.1.1)
Using faraday 1.3.0 (was 1.0.1)
Using addressable 2.7.0
Using pathutil 0.16.2
Using jekyll-coffeescript 1.1.1
Using nokogiri 1.11.1 (x86_64-darwin) (was 1.10.10)
Using terminal-table 1.8.0
Using bibtex-ruby 4.4.7
Using em-websocket 0.5.2
Using dnsruby 1.61.5 (was 1.61.4)
Using html-pipeline 2.14.0
Using ffi 1.14.2 (was 1.13.1)
Using sawyer 0.8.2
Using ethon 0.12.0
Fetching ruby-enum 0.9.0 (was 0.8.0)
Using typhoeus 1.4.0
Using octokit 4.20.0 (was 4.18.0)
Using rb-inotify 0.10.1
Using github-pages-health-check 1.16.1
Using sass-listen 4.0.0
Using listen 3.4.1 (was 3.2.1)
Using jekyll-gist 1.5.0
Using sass 3.7.4
Using jekyll-watch 2.2.1
Using jekyll-sass-converter 1.5.2
Using jekyll 3.8.5
Using jekyll-avatar 0.7.0
Using jekyll-github-metadata 2.13.0
Using jekyll-mentions 1.5.1
Using jekyll-optional-front-matter 0.3.2
Using jekyll-readme-index 0.3.0
Using jekyll-redirect-from 0.15.0
Using jekyll-relative-links 0.6.1
Using jekyll-remote-theme 0.4.1
Using jekyll-seo-tag 2.6.1
Using jekyll-sitemap 1.4.0
Using jekyll-titles-from-headings 0.5.3
Using jemoji 0.11.1
Using jekyll-scholar 5.16.0
Using jekyll-feed 0.13.0
Using jekyll-theme-cayman 0.1.1
Using jekyll-theme-dinky 0.1.1
Using jekyll-theme-hacker 0.1.1
Using jekyll-theme-leap-day 0.1.1
Using jekyll-theme-merlot 0.1.1
Using jekyll-default-layout 0.1.4
Using jekyll-theme-minimal 0.1.1
Using jekyll-theme-midnight 0.1.1
Using jekyll-theme-primer 0.5.4
Using jekyll-theme-slate 0.1.1
Using jekyll-theme-tactile 0.1.1
Using jekyll-theme-modernist 0.1.1
Using jekyll-theme-time-machine 0.1.1
Using minima 2.5.1
Using jekyll-theme-architect 0.1.1
Installing ruby-enum 0.9.0 (was 0.8.0)
Using commonmarker 0.17.13
Using jekyll-commonmark 1.3.1
Using jekyll-commonmark-ghpages 0.1.6
Using github-pages 204
Bundle updated!
此外,这就是 gemfile 的样子:
source "https://rubygems.org"
gem 'jekyll-scholar', group: :jekyll_plugins
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", "~> 204", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?
为什么不起作用? 我是 ruby 和 jekyll/github 页面的新手,但我创建了另一个 Github 页面的网站并且这个命令没有问题...
我遇到了同样的问题,我在 https://github.com/jekyll/jekyll/issues/8523
找到了解决方法将 gem "webrick"
添加到您网站的 Gemfile 中。比运行bundle install
此时你可以运行bundle exec jekyll serve
对我来说很管用!
我看到您正在使用 github-pages:204
和 jekyll:3.8.5
。
我使我的项目具有相同的依赖关系:
bundle update github-pages
bundle add webrick
感谢@choas 的评论,这是我解决问题的方法:
- 更新了 github 页、jekyll 和 jekyll-feed gem,作者是 运行ning
gem install github-pages
、gem install jekyll
和gem install jekyll-feed
。我必须执行此步骤,因为简单bundle update
没有安装最新版本。 - 将Gemfile中的那些gems修改为最新版本。
- 运行
bundle update
- 终于运行
bundle exec jekyll serve
我不确定所有这些步骤是否都是多余的,因为我对 Ruby/Github Pages/Jekyll 不是很熟悉,但它确实有效。
- 安装 webrick 和 jekyll-mentions:打开终端并输入
gem install webrick
然后gem install jekyll-mentions
. - 打开你的gem文件并在插件中添加gem“jekyll-mentions”和gem“webrick”:
group :jekyll_plugins do
gem "jekyll-mentions", "1.6.0"
gem "webrick"
end
- 导航回终端,然后执行
bundle install
。
我想你可以走了。这个过程对我有用!
我也遇到这个错误。解决方案在 documentation itself.
If you are using Ruby version 3.0.0 or higher, step 5 may fail(
bundle exec jekyll serve
). You may fix it by addingwebrick
to your dependencies:bundle add webrick
或在Gemfile
中添加gem "webrick"
,然后bundle install
。