在 Windows 上搭建本地 Jekyll 编译环境时问题汇总

按照 在 Windows 上安装 Jekyll 操作。

参考链接

故障诊断

问题一

    C:\WINDOWS\system32>gem install jekyll
    ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument @ rb_file_s_stat - H:/

HOMEDRIVE 被设置到了 H 盘。

解决办法

    SET HOMEDRIVE=C:

参考链接Error running gem install on Windows 7 64 bit

问题二

    C:\WINDOWS\system32>gem install jekyll
    ERROR:  Could not find a valid gem 'jekyll' (>= 0), here is why:
            Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

公司网络无法使用 https 访问 rubygems 官网。

解决办法

    gem install jekyll -r --source http://rubygems.org/

或者,修改根目录下面的 Gemfile 文件,将

    source 'https://rubygems.org'

改为

    source 'http://rubygems.org'

参考链接gem 2.0.3 Unable to download data from https://rubygems.org/ - … bad ecpoint

问题三

    jekyll serve                                                     
    C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bun
    dler (LoadError)                                                                                              
            from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'                 
            from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/lib/jekyll/plugin_manager.rb:34:in `require_f
    rom_bundler'                                                                                                  
            from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/jekyll-3.3.0/exe/jekyll:9:in `<top (required)>'           
            from C:/Ruby23-x64/bin/jekyll:23:in `load'                                                            
            from C:/Ruby23-x64/bin/jekyll:23:in `<main>'  

解决办法

    gem install bundler -r --source http://rubygems.org/

或者,从 rubygems.org 下载 gem,本地安装

    gem install bundler-1.13.6.gem

参考链接cannot load such file — bundler/setup (LoadError)

问题四

    jekyll serve
    C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/resolver.rb:366:in `block in verify_gemfile_
    dependencies_are_found!': Could not find gem 'github-pages x64-mingw32' in any of the gem sources listed in yo
    ur Gemfile or available on this machine. (Bundler::GemNotFound)
            from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/resolver.rb:341:in `each'
            from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/resolver.rb:341:in `verify_gemf
    ile_dependencies_are_found!'

解决办法

通过 bundler 安装依赖,

    bundle install

或者

    gem install github-pages -r --source http://rubygems.org/
    gem install wdm -r --source http://rubygems.org/

问题五

    C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:40:in `block in setup': You have already act
    ivated jekyll-sass-converter 1.4.0, but your Gemfile requires jekyll-sass-converter 1.3.0. Prepending `bundle exec` to yo
    ur command may solve this. (Gem::LoadError)  

解决办法

版本冲突,删除

    /Users/Air/git/fangchd/Gemfile.lock

或者

    gem uninstall jekyll-sass-converter
    Select gem to uninstall:
    1. jekyll-sass-converter-1.3.0
    2. jekyll-sass-converter-1.4.0
    3. All versions
    > 2
    Successfully uninstalled jekyll-sass-converter-1.4.0  

    gem uninstall kramdown
    gem uninstall jekyll 

参考链接You have already activated X, but your Gemfile requires Y

问题六

    jekyll serve
    ...
    Generating...
    Liquid Exception: No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configur
    ation, or set up an 'origin' git remote pointing to your github.com repository. in /Users/dongf/MyStuff/git/fangchd.githu
    b.io/_layouts/default.html
            ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configur
    ation, or set up an 'origin' git remote pointing to your github.com repository.

解决办法

在 fangchd.github.io_config.yml 中添加

    repository: fangchd/fangchd.github.io

参考链接Cannot run Jekyll locally with “No repo name found”.

问题七

    GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

解决办法

在系统环境变量中添加 JEKYLL_GITHUB_TOKEN 和 SSL_CERT_FILE。

如果通过代理才能访问 GitHub,设置环境变量 HTTP_PROXY

    SET HTTP_PROXY=http://domain%5Cusername:[email protected]:port

如果是在 MacOS 下,则需要使用

    export http_proxy='http://127.0.0.1:4411/'

参考链接

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值