#jekyll 本地服务无法启动

临时笔记,记录安装jekyll时遇到的问题再次遇到时的解决,以备后续查阅.

$ jekyll server
Configuration file: /Users/chenkun/git/eoekun-blog/_config.yml
Configuration file: /Users/chenkun/git/eoekun-blog/_config.yml
            Source: /Users/chenkun/git/eoekun-blog
       Destination: /Users/chenkun/git/eoekun-blog/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Dependency Error: Yikes! It looks like you don't have redcarpet 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 -- redcarpet' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2014-08-22-jekyll-clean-theme.md':
                    redcarpet
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    redcarpet

根据提示安装redcarpet.

#安装redcarpet提示无权限

$ gem install redcarpet
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Fetching: redcarpet-3.4.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
chenkun:eoekun-blog chenkun$ gem install redcarpet -p
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

更正命令

$ sudo gem install redcarpet
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Fetching: redcarpet-3.4.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/redcarpet
chenkun:eoekun-blog chenkun$ sudo gem install redcarpet
chenkun:eoekun-blog chenkun$ sudo gem install redcarpet
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/redcarpet

发现还是没权限,经过查询资料stackoverflow得知自从XX版本后什么权限什么的,需要开启禁用的,赶脚好麻烦,找到一个中转的办法

$ sudo gem install -n /usr/local/bin  redcarpet
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Building native extensions.  This could take a while...
Successfully installed redcarpet-3.4.0
Parsing documentation for redcarpet-3.4.0
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/redcarpet-3.4.0/redcarpet.bundle, skipping
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/redcarpet.bundle, skipping
Installing ri documentation for redcarpet-3.4.0
1 gem installed

还是有报错ssl证书验证失败啥的,但是好像是安装成功了,试一试jekyll的启动

$ jekyll server
Configuration file: /Users/chenkun/git/eoekun-blog/_config.yml
Configuration file: /Users/chenkun/git/eoekun-blog/_config.yml
            Source: /Users/chenkun/git/eoekun-blog
       Destination: /Users/chenkun/git/eoekun-blog/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.52 seconds.
 Auto-regeneration: enabled for '/Users/chenkun/git/eoekun-blog'
Configuration file: /Users/chenkun/git/eoekun-blog/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

可以正常运行了!