Jekyll Ubuntu 环境初始化

2017-06-27 Renfei Yu 更多博文 » 博客 » GitHub »


在发布到github pages 时,需要本地预览效果,这时需要安装本的jekyll环境,这里说明安装过程中的主要步骤以及相应的解决办法。

Install CURL

apt-get install curl

Install RVM

gpg2 --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL | bash -s stable

source rvm environment

source /home/user/.rvm/scripts/rvm

Install Ruby Dependencies

rvm requirements

Install ruby

rvm isntall 2.4.0

set Default ruby version

rvm use 2.4.0 --default

install jekyll

gem install jekyll kramdown

gem 包含在rubygem中,安装完ruby后,自然会安装


/home/user/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
    from /home/user/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/user/.rvm/gems/ruby-2.4.0/gems/jekyll-3.5.0/lib/jekyll/plugin_manager.rb:46:in `require_from_bundler'
    from /home/user/.rvm/gems/ruby-2.4.0/gems/jekyll-3.5.0/exe/jekyll:9:in `<top (required)>'
    from /home/user/.rvm/gems/ruby-2.4.0/bin/jekyll:22:in `load'
    from /home/user/.rvm/gems/ruby-2.4.0/bin/jekyll:22:in `<main>'
    from /home/user/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    from /home/user/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'


gem install bundler
gem install github-pages

JavaScript 运行环境问题

Jekyll 3.4.3 | Error:  Could not find a JavaScript runtime. See for a list of available runtimes.


sudo apt-get install nodejs


  Liquid Exception: undefined method `map' for false:FalseClass Did you mean? tap in /_layouts/page.html

  • 问题参考 使用jekyll新建一个主页,解决此问题
 Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.

配置文件_config.yml中,使用了 plugins 的配置项,应该是用plugins替换掉gems。

调用github 无法获取token的问题

  • 问题描述

    GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data
  • 解决方法

    JEKYLL_GITHUB_TOKEN=<your token> jekyll serve -H
  • 参考资料 No GitHub API authentication" error