运行 jekyll 服务器在 windows 7 上时出错
Error when run jekyll server on windows 7
我在我的本地机器上尝试 运行 Jekyll
服务器,所以当我 运行 jekyll server
在终端中时,返回休闲消息:
$ 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 时出现液体异常的原因。
根据 this tutorial, which is the suggested tutorial written by Julian Thilo on the Jekyll documentation,撰写本文时您需要 Python 2.7.x
。以下是安装 Jekyll 和服务器并 运行ning 需要执行的操作的摘要。
第一步:获取Python
下载最新版本Python 2.7:here
注意: 确保将 python.exe 添加到路径和 select “整个功能将安装在本地硬盘上。 这在 Windows 上是必需的,否则 Jekyll 在尝试使用 Pygments 高亮代码时将无法构建网站。
步骤 2:安装 Pip
这是一个 Python 包管理器,您将使用它来安装 Pygments。 follow the official documentation for doing this.
第 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 上的 103=]s)。您需要像这样编辑 _config.yml
以使用 rouge
:highlighter : rouge
和 运行 gem install rouge
在命令行中,如同一教程中所述。 请注意,在撰写本文时 Rouge 有 lesser language support compared to Pygments.(但仍然很多)
这是关于 setting up Jekyll on Windows. And it would be a good idea to follow the excellent tutorial 的另一个教程,我之前已经链接到在 Windows 上安装 Jekyll。
我在我的本地机器上尝试 运行 Jekyll
服务器,所以当我 运行 jekyll server
在终端中时,返回休闲消息:
$ 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 时出现液体异常的原因。
根据 this tutorial, which is the suggested tutorial written by Julian Thilo on the Jekyll documentation,撰写本文时您需要 Python 2.7.x
。以下是安装 Jekyll 和服务器并 运行ning 需要执行的操作的摘要。
第一步:获取Python
下载最新版本Python 2.7:here
注意: 确保将 python.exe 添加到路径和 select “整个功能将安装在本地硬盘上。 这在 Windows 上是必需的,否则 Jekyll 在尝试使用 Pygments 高亮代码时将无法构建网站。
步骤 2:安装 Pip
这是一个 Python 包管理器,您将使用它来安装 Pygments。 follow the official documentation for doing this.
第 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 上的 103=]s)。您需要像这样编辑 _config.yml
以使用 rouge
:highlighter : rouge
和 运行 gem install rouge
在命令行中,如同一教程中所述。 请注意,在撰写本文时 Rouge 有 lesser language support compared to Pygments.(但仍然很多)
这是关于 setting up Jekyll on Windows. And it would be a good idea to follow the excellent tutorial 的另一个教程,我之前已经链接到在 Windows 上安装 Jekyll。