V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
CNN
V2EX  ›  问与答

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

  •  
  •   CNN · 2022-01-19 21:21:34 +08:00 · 864 次点击
    这是一个创建于 1041 天前的主题,其中的信息可能已经有所发展或是发生改变。

    前面都完成了,就是最后一步 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 % 
    
    
    第 1 条附言  ·  2022-01-19 21:54:44 +08:00
    包括进入本地其他博客也是出现这种错误
    4 条回复    2022-01-19 22:10:11 +08:00
    mschultz
        1
    mschultz  
       2022-01-19 22:05:10 +08:00   ❤️ 1
    先运行下 bundle add webrick 再试试?
    mschultz
        2
    mschultz  
       2022-01-19 22:05:23 +08:00
    yaoyao1128
        3
    yaoyao1128  
       2022-01-19 22:07:05 +08:00 via iPhone   ❤️ 1
    CNN
        4
    CNN  
    OP
       2022-01-19 22:10:11 +08:00
    @mschultz
    @yaoyao1128

    感谢,完美解决
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3554 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:41 · PVG 12:41 · LAX 20:41 · JFK 23:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.