网上关于使用jekyll建立自己的blog很多,但是安装了最新的ruby和jekyll的时候 出现了各类问题
我先将我遇到的问题显示出来,便于新手安装的时候出现同样的问题便于进行检索
问题:
question 1:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/resolver.rb:35 6:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'mini ma x64-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. (Bundler::GemNotFound)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/r esolver.rb:331:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/r esolver.rb:331:in `verify_gemfile_dependencies_are_found!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/r esolver.rb:200:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/r esolver.rb:184:in `resolve'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/d efinition.rb:200:in `resolve'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/d efinition.rb:140:in `specs'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/d efinition.rb:185:in `specs_for'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/d efinition.rb:174:in `requested_specs'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/e nvironment.rb:19:in `requested_specs'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/r untime.rb:14:in `setup'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler.r b:95:in `setup'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/jekyll-3.2.1/lib/jekyll/plug in_manager.rb:36:in `require_from_bundler'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/jekyll-3.2.1/exe/jekyll:9:in `<top (required)>'
from C:/Ruby22-x64/bin/jekyll:22:in `load'
from C:/Ruby22-x64/bin/jekyll:22:in `<main>'
answer:
$ cd 你的blog根目录
$ bundle install
这个问题很明显,提示没有(Bundler::GemNotFound)
following question one:
$ bundle install
<pre name="code" class="plain"><span style="color: rgb(36, 39, 41); font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; background-color: rgb(255, 248, 220);">Could not locate Gemfile</span>
answer: 必须进入你的blog根目录之后,你才能找到gemfile文件,并且进行安装bundle
question two:
$ jekyll serve
Configuration file: C:/devkit/jekyll/_config.yml
Source: C:/devkit/jekyll
Destination: C:/devkit/jekyll/_site
Incremental build: disabled. Enable with --incremental
Generating...
<span style="background-color: rgb(255, 0, 0);"> ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/ruby/2.2.0/gems/jekyll-3.2.1/lib/site_template/_pos ts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.</span>
$ cd 你的blog根目录
$ vi _config.yml
在最下面一行添加一行“exclude: [vendor]”
这问题是因为你的网站安装在了devkit目录下
jekyll new 你的blog的时候 该目录不应该与jekyll安装目录在一起
这个问题我是在stackoverflow上找到解决办法的:点击打开链接
如果你遇到了使用gem出现了
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
使用
gem sources --remove https://rubygems.org/gem source -a https://gems.ruby-china.org
或者
gem source -a http://gems.ruby-china.org
切换到non-ssl 网站
question:
我下载的gemfile中需要
gem "jekyll-sitemap"
gem "pygments.rb"
所以我们需要安装这些依赖包
直接gem install jekyll-sitemap
和 gem install pygments.rb
即可解决
Could not find gem ' x64-mingw32' in any of the gem sources listed in your Gemfile
这类问题
因为按照jekyll的教程很多,我大体描述一下这个安装过程
1. ruby install
2. $gem update -- system
3. install DevKit
4. cd devkit -> ruby dk.rb init -> ruby dk.rb install
5. gem install jekyll
5. jekyll new your_site or git clone jekyll_bootstrap
6. jekyll serve
最后附上我成功运行的图片