Jekyll - Liquid Exception: unable to load such a file - yajl / 2.0 / yajl

I'm trying to get Jekyll to work on Windows, and I'm out of luck. This is the first time I have installed / used Ruby.

The error disappears when I set pygments to false in _config.yml .

Error message

 D:\Code\Jekyll\test>jekyll serve Configuration file: D:/Code/Jekyll/test/_config.yml Source: D:/Code/Jekyll/test Destination: D:/Code/Jekyll/test/_site Generating... Liquid Exception: cannot load such file -- yajl/2.0/yajl in 2013-05-11-welcome-to-jekyll.markdown C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.1.0-x86-mingw32/lib/yajl/yajl.rb:2:in `<top (required)>' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.1.0-x86-mingw32/lib/yajl.rb:1:in `<top (required)>' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/gems/2.0.0/gems/pygments.rb-0.4.2/lib/pygments/popen.rb:3:in `<top (required)>' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/gems/2.0.0/gems/pygments.rb-0.4.2/lib/pygments.rb:1:in `<top (required)>' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/tags/highlight.rb:52:in `render_pygments' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/tags/highlight.rb:45:in `render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/block.rb:106:in `block in render_all' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/block.rb:93:in `each' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/block.rb:93:in `render_all' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/block.rb:82:in `render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/template.rb:124:in `render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.0/lib/liquid/template.rb:132:in `render!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/convertible.rb:77:in `render_liquid' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/convertible.rb:128:in `do_layout' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/post.rb:285:in `render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/site.rb:230:in `block in render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/site.rb:229:in `each' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/site.rb:229:in `render' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/site.rb:44:in `process' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/command.rb:18:in `process_site' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/commands/build.rb:23:in `build' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/lib/jekyll/commands/build.rb:7:in `process' C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-1.0.1/bin/jekyll:83:in `block (2 levels) in <top (required)>' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:180:in `call' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:180:in `call' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:155:in `run' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/runner.rb:402:in `run_active_command' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/runner.rb:66:in `run!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/delegates.rb:7:in `run!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/import.rb:10:in `block in <top (required)>' Build Failed 
+6
source share
7 answers

The problem was like @scriptin mentioned in the comments.

I installed ruby ​​v 1.9.3 instead, and it solved my problem.

+2
source

I did the following

 gem install rouge 

and then the following line is added in _config.yml

 highlighter: rouge 

I found this solution from the following line of comments on the page https://github.com/jekyll/jekyll-help/issues/50

+12
source

just add the following line to _config.yml

 highlighter: false 

Now go to localhost: 4000

+2
source

Today I encountered a similar problem when trying to configure Octopress / Jekyll.

Here is the solution I found.

Step 1

Go to the ruby ​​gem catalog. In my case, it was in C:/Ruby21/lib/ruby/gems/2.1.0/gems

Look for the juggle.

image1

You will see a folder called yajl-ruby-1.1.0-x86-mingw32

You may or may not see one of the named yajl-ruby-1.2.1

The default tail is -ruby-1.1.0-x86-mingw32. And leads to an error.

We want to use a different version

Step 2

If you do not have a version of none mingw32, run

 gem install yajl-ruby 

This will install the latest version.

In my case, the latest version was 1.2.1

Step 3

Change the default value from mingw32 version to current version.

To do this, go to gemfile.lock

Find the line that says yajl-ruby (1.1.0-x86-mingw32)

and change it to yajl-ruby (1.2.1)

or the corresponding version that you downloaded

img_beforeimg_after

Step 4

What is it. Now it should work.

+1
source

You can get around this by manually editing the file, which gives an error to look like this.

RUBY_VERSION = ~ / (\ d +. \ D +) / require "yajl"

0
source

Other proposed solutions seem to either turn off code allocation or set it to use Rouge instead of Pyigs. I need to use Pyigs because of more language support.

As described at https://github.com/brianmario/yajl-ruby/issues/116 , this problem occurs because the precompiled yajl will not work with Ruby 2.0. It must be compiled. To make this work so that you can use pygments:

  • Remove the precompiled yajl-ruby gem.
  • Install it using the syntax shown in this github thread. Please note that you may need to specify a version. In my case, Jekyll specifically wanted 1.1.0, so I installed this syntax:

gem install yajl-ruby --platform = ruby ​​--version = 1.1.0

After that, Jekyll worked without turning off code highlighting or switching to Rouge.

0
source

Install yajl 1.2.0. This seems to be a bug with 1.2.1.

 gem install yajl-ruby --version=1.2.0 --platform=ruby 

the problem is resolved.

I'm not sure that part of the platform is important, as others think, but it worked for me.

0
source

Source: https://habr.com/ru/post/944769/


All Articles