Jekyll on Windows: Pygments not working

2019-01-31 06:11发布

I updated to the latest JekyllBuild (1.0.3) before I always used the RC. After updating the parsing of codes (with Pygments) doesn't work anymore. I always get the following error:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162: warning: cannot close fd before spawn
←[31m  Liquid Exception: No such file or directory - /bin/sh in 2012-01-17-test-post.md←[0m

Did anyone also ran into this problem?

I have no clue about ruby, so I can not debug this myself :(

10条回答
相关推荐>>
2楼-- · 2019-01-31 06:27

For me, the fix was to add a symbolic link to python.exe called python2.exe

Do this, with elevated privileges, in the directory where python 2.x is installed:

mklink python2.exe python.exe
查看更多
Luminary・发光体
3楼-- · 2019-01-31 06:30

Adding to what @noobcode said, you can actually continue to use pygments.rb if you add the Python27 directory (wherever you stored it) to your path (as another user mentioned in a response to a thread above).

Those who don't have any idea how to add the directory to their PATH should visit this site.

查看更多
神经病院院长
4楼-- · 2019-01-31 06:36

Expanding upon zzheng's explanation, if you're still having issues try running gem list. Then make sure pygments.rb (0.5.2) isn't installed. If it is, just run this command.

gem uninstall pygments.rb --version "=0.5.2"

That should take care of your problem, and you should be able to publish with Jekyll happily on Windows once again.

EDIT: Also, based upon my own experience, this may cause another error. Liquid Error: Failed to get header. in 2013-07-20-post-name-here.md. The (unconfirmed) solution is to install Python 2.7.* if you have not already done so, although some people report that this does not fix the problem.

Further Reading:

Jekyll Github Issue #1181

Pygments.rb Github Issue #45

Run jekyll --server Failed in Win7

查看更多
甜甜的少女心
5楼-- · 2019-01-31 06:38
劳资没心,怎么记你
6楼-- · 2019-01-31 06:39

if you add highlighter: false to your config.yml, you can avoid loading Pygments at all

查看更多
爷、活的狠高调
7楼-- · 2019-01-31 06:40

I had the same issue. Seems there's a problem in Pygments.rb 0.5.1. By rolling back to Pygments 0.5.0 the error disappeared.

gem uninstall pygments.rb --version ">0.5.0"
gem install pygments.rb --version "=0.5.0"

Hope this helps.

查看更多
登录 后发表回答