在Windows 7上运行jekyll服务器时出错

我正在尝试在我的本地机器上运行Jekyll服务器,所以当我在终端中运行jekyll server时,返回fallowing消息:

 $ jekyll serve Configuration file: C:/xxx/Site/_config.yml Source: C:/xxx/Site Destination: C:/xxx/Site/_site Generating... c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/posix-spawn-0.3.11/lib/posix/spawn.rb:164: warning: cannot close fd before spawn 'which' não é reconhecido como um comando interno ou externo, um programa operável ou um arquivo em lotes. Liquid Exception: No such file or directory - python c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pygments.rb-0.6.0/lib/pygments/mentos.py in _posts/2015-06-02-welcome-to-j ekyll.markdown done. Please add the following to your Gemfile to avoid polling for changes: gem 'wdm', '>= 0.1.0' if Gem.win_platform? Auto-regeneration: enabled for 'C:/xxx/Site' Configuration file: C:/xxx/Site/_config.yml Server address: http://127.0.0.1:4000/ Server running... press ctrl-c to stop. 

因为我尝试输入http://127.0.0.1:4000/ ,没有发生,没有错误,没有404,只有一个空页面。

哪里有问题?

Python似乎没有安装,这就是为什么在尝试使用代码突出显示器Pygments时会出现流量exception的原因。

根据本教程 ,这是Julian Thilo在Jekyll文档中编写的建议教程,在编写本文时需要Python 2.7.x 以下是您需要做什么才能使Jekyll安装和服务器启动并运行。

第1步:获取Python

下载最新版本的Python 2.7: 此处

注意:确保将python.exe添加到Path并选择“将在本地硬盘驱动器上安装整个function。 这在Windows上是必需的,否则当尝试使用Pygments突出显示代码时,Jekyll将无法构建网站。

第2步:安装Pip

它是一个Python包管理器,您将用它来安装Pygments。 按照官方文档执行此操作。

第3步:获取Pygments

最后,打开命令行并键入python -m pip install Pygments

第4步:完成

再次运行jekyll serve

可选步骤

由于Pygments是默认语法高亮显示,因此您不必明确定义您正在使用的荧光笔,但如果您愿意,可以将此行添加到_config.yml文件中: highlighter : pygments

替代方案1:不要想要荧光笔

如果你不使用代码荧光笔只需编辑降价post你有2015-06-02-welcome-to-jekyll.markdown并删除Liquid标签,如下所示:

{% highlight ruby %}

  //Ruby code on the template you can ignore 

{% endhighlight %}

替代方案2:胭脂,不需要Python

Rouge是一个Ruby代码高亮显示器,虽然它不需要Python和所有依赖项,因为它完全用Ruby编写(你已经拥有它,因为Jekyll在Ruby上运行)。 您需要编辑_config.yml以使用如下的rougehighlighter : rouge ,并在命令行中运行gem install rouge ,如同一个教程中所述。 请注意,在撰写本文时, 与Pygments相比, Rouge的语言支持较少 。 (但仍然很多)

这是关于在Windows上设置Jekyll的另一个教程。 并且遵循我以前链接的在Windows上安装Jekyll的优秀教程是个好主意。