小白求救: jekyll 无法预览博客,如何解决?

2022-01-19 21:21:34 +08:00
 CNN

前面都完成了,就是最后一步 bundle exec jekyll serve 出错。


mac@mac ~ % jekyll new myblog
Running bundle install in /Users/mac/myblog... 
  Bundler: Fetching gem metadata from https://rubygems.org/..........
  Bundler: Resolving dependencies...
  Bundler: Using bundler 2.3.5
  Bundler: Using eventmachine 1.2.7
  Bundler: Using public_suffix 4.0.6
  Bundler: Using colorator 1.1.0
  Bundler: Using concurrent-ruby 1.1.9
  Bundler: Using http_parser.rb 0.8.0
  Bundler: Using ffi 1.15.5
  Bundler: Using forwardable-extended 2.6.0
  Bundler: Using rb-fsevent 0.11.0
  Bundler: Using rexml 3.2.5
  Bundler: Using liquid 4.0.3
  Bundler: Using mercenary 0.4.0
  Bundler: Using addressable 2.8.0
  Bundler: Using rouge 3.27.0
  Bundler: Using safe_yaml 1.0.5
  Bundler: Using unicode-display_width 1.8.0
  Bundler: Using em-websocket 0.5.3
  Bundler: Using i18n 1.8.11
  Bundler: Using pathutil 0.16.2
  Bundler: Using sassc 2.4.0
  Bundler: Using rb-inotify 0.10.1
  Bundler: Using kramdown 2.3.1
  Bundler: Using terminal-table 2.0.0
  Bundler: Using listen 3.7.1
  Bundler: Using jekyll-sass-converter 2.1.0
  Bundler: Using kramdown-parser-gfm 1.1.0
  Bundler: Using jekyll-watch 2.2.1
  Bundler: Using jekyll 4.2.1
  Bundler: Using jekyll-feed 0.16.0
  Bundler: Using jekyll-seo-tag 2.7.1
  Bundler: Using minima 2.5.1
  Bundler: Bundle complete! 6 Gemfile dependencies, 31 gems now installed.
  Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /Users/mac/myblog. 
mac@mac ~ % cd myblog
mac@mac myblog % bundle exec jekyll serve
Configuration file: /Users/mac/myblog/_config.yml
            Source: /Users/mac/myblog
       Destination: /Users/mac/myblog/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
                    done in 0.527 seconds.
 Auto-regeneration: enabled for '/Users/mac/myblog'
                    ------------------------------------------------
      Jekyll 4.2.1   Please append `--trace` to the `serve` command 
                     for any additional information or backtrace. 
                    ------------------------------------------------
/Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:179:in `require_relative'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:179:in `setup'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:100:in `process'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `each'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-4.2.1/exe/jekyll:15:in `<top (required)>'
	from /Users/mac/.rbenv/versions/3.1.0/bin/jekyll:25:in `load'
	from /Users/mac/.rbenv/versions/3.1.0/bin/jekyll:25:in `<top (required)>'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli/exec.rb:58:in `load'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli/exec.rb:23:in `run'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli.rb:484:in `exec'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli.rb:31:in `dispatch'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/cli.rb:25:in `start'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/exe/bundle:48:in `block in <top (required)>'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /Users/mac/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.5/exe/bundle:36:in `<top (required)>'
	from /Users/mac/.rbenv/versions/3.1.0/bin/bundle:25:in `load'
	from /Users/mac/.rbenv/versions/3.1.0/bin/bundle:25:in `<main>'
mac@mac myblog % 

859 次点击
所在节点    问与答
4 条回复
mschultz
2022-01-19 22:05:10 +08:00
先运行下 bundle add webrick 再试试?
mschultz
2022-01-19 22:05:23 +08:00
yaoyao1128
2022-01-19 22:07:05 +08:00
CNN
2022-01-19 22:10:11 +08:00
@mschultz
@yaoyao1128

感谢,完美解决

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/829326

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX