0. 前言

今天写了一篇文章,发布的时候居然告诉我jekyll没有安装,估计是之前系统更新的问题,只能重新装一遍。结果问题还真不少,这里简单记录下。

1. 安装

1.1 安装rvm | 更新ruby

系统默认带的ruby版本是2.0.0,太老了,需要更新。

curl -sSL https://get.rvm.io | bash -s stable
rvm list known
rvm install ruby-2.4.0 --verbose
rvm use ruby-2.4.0 --default

1.2 更新gem源

删掉所有莫名其妙的源

gem sources -r ${source}

添加官方唯一的源

gem sources -a https://rubygems.org/

1.3 安装Jekyll

别问我为什么需要sudo,这货就是需要权限

sudo gem install jekyll --verbose

1.4 安装语法高亮

我使用的时候报了个错:

Dependency Error: Yikes! It looks like you don’t have pygments or one of its dependencies installed. In order to use Jekyll as currently configured, you’ll need to install this gem. The full error message from Ruby is: ‘cannot load such file – pygments’

安装pygments的时候报错:

sudo gem install pygments --verbose
# Password:
# HEAD https://api.rubygems.org/api/v1/dependencies
# 200 OK
# GET https://api.rubygems.org/api/v1/dependencies?gems=pygments
# 200 OK
# ERROR:  Could not find a valid gem 'pygments' (>= 0) in any repository
# GET https://api.rubygems.org/latest_specs.4.8.gz
# 200 OK
# ERROR:  Possible alternatives: pigments, rygments, pigment, rb-pygments, segments

结果找了半天,正确的gem名字应该是:pygments.rb

sudo gem install pygments.rb --verbose