在Windows 7上运行jekyll服务器时出错 [英] Error when run jekyll server on windows 7

查看:96
本文介绍了在Windows 7上运行jekyll服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying run Jekyll server in my local machine, so when I run jekyll server in terminal, returning fallowing message:

$ 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,只有一个空白页.

Cause I trying enter http://127.0.0.1:4000/, is not happen, no error, no 404, only a empty page.

哪里有问题?

推荐答案

似乎没有安装Python,这就是为什么在尝试使用代码突出显示的Pygments时会出现液体异常的原因.

Python does not appear to be installed, which is why you get a liquid exception when trying to use the code highlighter Pygments.

根据本教程,这是朱利安(Julian)编写的建议教程在 Jekyll文档上,您在撰写本文时需要Python 2.7.x.这是要启动和运行Jekyll的安装和服务器所需执行的操作的摘要.

According to this tutorial, which is the suggested tutorial written by Julian Thilo on the Jekyll documentation, you need Python 2.7.x at time of writing. Here is a summary of what you need to do to get the Jekyll install and server up and running.

第1步:获取Python

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

Download the latest version of Python 2.7: here

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

Note: Make sure to add python.exe to Path and select "Entire feature will be installed on local hard drive. This is needed on Windows or else Jekyll will fail to build the website when trying to highlight code with Pygments.

第2步:安装Pip

这是一个Python软件包管理器,可用于安装Pygments. 按照官方文档进行操作.

It's a Python package manager which you'll use to install Pygments. follow the official documentation for doing this.

第3步:获取Pygments

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

Finally, Open up a command line and type in python -m pip install Pygments

第4步:完成

再次运行jekyll serve.

可选步骤

由于Pygments是默认的语法突出显示器,因此不必显式定义要使用的突出显示器,但是如果愿意,可以将此行添加到_config.yml文件中:highlighter : pygments

Since Pygments is the default syntax highlighter, you don't have to explicitly define what highlighter you're using, but if you prefer to, add this line to your _config.yml file: highlighter : pygments

替代方法1:不需要荧光笔

如果您将不使用代码突出显示功能,只需编辑具有2015-06-02-welcome-to-jekyll.markdown的markdown帖子并按以下方式删除Liquid标签:

If you won't be using a code highlighter just edit the markdown post you have 2015-06-02-welcome-to-jekyll.markdown and remove the Liquid tags like so:

{% highlight ruby %}

  //Ruby code on the template you can ignore

{% endhighlight %}

替代2:胭脂,不需要Python

Rouge是Ruby代码突出显示器,尽管它完全是用Ruby编写的(因为Jekyll在Ruby上运行,所以它已经不需要了),但它不需要Python及其所有依赖项.您需要编辑_config.yml以使用rouge,如下所示:highlighter : rouge,并在命令行中运行gem install rouge,如同一教程中所述. 请注意,在撰写本文时,胭脂具有较少的语言相对于Pygments .(但仍然很多)

Rouge is a Ruby code highlighter, which while does not require Python and all that dependencies as it is written completely in Ruby (which you already have because Jekyll runs on Ruby). You'll need to edit the _config.yml to use rouge like so: highlighter : rouge, and run gem install rouge in the command line, as mentioned in same tutorial. Note that at time of writing Rouge has lesser language support compared to Pygments. (but still a whole lot)

这里是有关在Windows上设置Jekyll 的另一本教程.遵循优秀教程(我之前已链接在Windows上安装Jekyll)是一个好主意. .

Here's another tutorial on setting up Jekyll on Windows. And it would be a good idea to follow the excellent tutorial I've previously linked for installing Jekyll on Windows.

这篇关于在Windows 7上运行jekyll服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆