V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nuc093
V2EX  ›  macOS

OSX jekyll install 后 jekyll 启动报如下错误

  •  
  •   nuc093 · 2016-12-12 12:25:12 +08:00 · 2635 次点击
    这是一个创建于 1987 天前的主题,其中的信息可能已经有所发展或是发生改变。

    qk:b qk$ jekyll server /usr/local/Cellar/ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler (LoadError) from /usr/local/Cellar/ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.3.1/lib/jekyll/plugin_manager.rb:34:in require_from_bundler' from /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.3.1/exe/jekyll:9:in<top (required)>' from /usr/local/bin/jekyll:22:in load' from /usr/local/bin/jekyll:22:in<main>'

    13 条回复    2016-12-15 09:48:50 +08:00
    SoloCompany
        1
    SoloCompany  
       2016-12-12 13:25:59 +08:00
    如果你希望使用的是 github-pages 的话
    应该用 gem install github-pages 来安装 jekyll
    marenight
        2
    marenight  
       2016-12-12 15:18:10 +08:00 via iPhone
    有可能是 ruby 版本问题
    nuc093
        3
    nuc093  
    OP
       2016-12-12 20:25:18 +08:00
    感谢楼上两位帮助,我搜了一下相关的问题及一些解决方法是:

    https://github.com/jekyll/jekyll/issues/3984


    Proposed Checklist for Mac OS X 10.11 El Capitan

    Install the Xcode command line utilities xcode-select --install
    Install Homebrew (instructions at http://brew.sh)
    Modify $PATH to use Homebrew export PATH=/usr/local/bin:$PATH
    Modify $PATH for GUI apps launchctl setenv PATH "/usr/local/bin:$PATH"
    Install the latest Ruby brew install ruby
    Install the latest Jekyll gem install jekyll


    http://stackoverflow.com/questions/31567029/how-can-i-install-jekyll-on-osx-10-11

    Jekyll & Mac OS X 10.11

    http://jekyllrb.com/docs/troubleshooting/#jekyll-amp-mac-os-x-1011
    nuc093
        4
    nuc093  
    OP
       2016-12-12 20:27:19 +08:00
    不过我照我找到的方法做了好几篇还是报同样的错
    nuc093
        5
    nuc093  
    OP
       2016-12-12 20:29:32 +08:00
    qk:b qk$ echo $PATH
    /usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/qk/.rvm/bin
    qk:b qk$ ruby --version
    ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
    046569
        6
    046569  
       2016-12-12 23:00:40 +08:00
    LZ 贴下下面两条命令的结果
    `which bundle
    gem list|grep bundler`
    nuc093
        7
    nuc093  
    OP
       2016-12-13 09:07:45 +08:00
    @046569
    ➜ ~ which bundle
    bundle not found
    ➜ ~ gem list|grep bundler
    046569
        8
    046569  
       2016-12-13 10:22:54 +08:00
    @nuc093
    你忘记安装包管理了.
    gem install bundler
    然后再试.
    nuc093
        9
    nuc093  
    OP
       2016-12-13 20:54:43 +08:00
    @046569

    ➜ b git:(gh-pages) ✗ which bundle
    /usr/local/bin/bundle
    ➜ b git:(gh-pages) ✗ jekyll --server
    /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:179:in `rescue in specs': Your bundle is locked to i18n (0.7.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of i18n (0.7.0) has removed it. You'll need to update your bundle to a different version of i18n (0.7.0) that hasn't been removed in order to install. (Bundler::GemNotFound)
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:173:in `specs'
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:233:in `specs_for'
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:222:in `requested_specs'
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:118:in `block in definition_method'
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:19:in `setup'
    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:99:in `setup'
    from /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.3.1/lib/jekyll/plugin_manager.rb:36:in `require_from_bundler'
    from /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.3.1/exe/jekyll:9:in `<top (required)>'
    from /usr/local/bin/jekyll:22:in `load'
    from /usr/local/bin/jekyll:22:in `<main>'

    ### 可能还是版本问题
    046569
        10
    046569  
       2016-12-14 09:14:02 +08:00
    猜测你下载了一个老项目,或者别人的模板?
    检查:
    1. 原项目中标明的 ruby 版本,并且执行 bundle install .
    2. Gemfile 的相关文件中的内容是否正确,比如源?
    3. 如果都没问题,尝试升级下 Gemfile ?
    nuc093
        11
    nuc093  
    OP
       2016-12-14 10:12:59 +08:00
    @046569
    嗯 我先是 brew install ruby 的,后来 rbevn install 某版本。
    nuc093
        12
    nuc093  
    OP
       2016-12-15 09:45:33 +08:00
    @046569
    是别人的模板。正如你所定位的问题,敲以下两个命令

    ➜ b git:(gh-pages) ✗ bundle update

    ➜ b git:(gh-pages) ✗ bundle exec jekyll serve

    http://idratherbewriting.com/documentation-theme-jekyll/

    按照此文章的第四点进行操作

    ### 4. Option 2: Build the Theme (with the github-pages gem)

    If you are in fact publishing on Github Pages, leave the Gemfile and Gemfile.lock files in the theme.The Gemfile tells Jekyll to use the github-pages gem. However, note that you cannot use the normal jekyll serve command with this gem due to dependency conflicts between the latest version of Jekyll and Github Pages (which are noted briefly here).

    You need Bundler to resolve these dependency conflicts. Use Bundler to install all the needed Ruby gems:

    bundle update
    Then always use this command to build Jekyll:

    bundle exec jekyll serve
    046569
        13
    046569  
       2016-12-15 09:48:50 +08:00
    @nuc093
    解决就好,写写博客还是挺好的.我一直在写.
    关于   ·   帮助文档   ·   API   ·   FAQ   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2433 人在线   最高记录 5497   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 05:39 · PVG 13:39 · LAX 22:39 · JFK 01:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.