New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquid Exception: undefined method on windows #3078

Closed
THE-117 opened this Issue Nov 8, 2014 · 14 comments

Comments

Projects
None yet
7 participants
@THE-117
Copy link

THE-117 commented Nov 8, 2014

Hi Guys !
Do any one have a solution to this issue !
i am using windows
jekyll 2.4.0

D:\Dev\Awesome>jekyll serve
Configuration file: D:/Dev/Awesome/_config.yml
            Source: D:/Dev/Awesome
       Destination: D:/Dev/Awesome/_site
      Generating...
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:
 warning: cannot close fd before spawn
'which' is not recognized as an internal or external command,
operable program or batch file.
  Liquid Exception: undefined method `[]' for nil:NilClass in _posts/2014-11-09-welcome-to-jekyll.markdown
jekyll 2.4.0 | Error:  undefined method `[]' for nil:NilClass

My Config.yml:

---
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#

---
- C:/Ruby21-x64
# Build settings
highlighter: true
markdown: kramdown
highlighter: pygments
@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 8, 2014

Not sure... /cc @jekyll/help, any thoughts?

@parkr parkr added the support label Nov 8, 2014

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 9, 2014

If you run gem install rouge, set your highlighter: rouge, and rebuild, what happens?

Also, you have a duplicate in your _config.yml.

@THE-117

This comment has been minimized.

Copy link

THE-117 commented Nov 9, 2014

Thnx a lot !
it worked !!

@THE-117 THE-117 closed this Nov 9, 2014

@vance

This comment has been minimized.

Copy link

vance commented Nov 23, 2014

I have the same issue on windows 8, fresh install of ruby, py34 and jekyll 2.5.1

I set highlighter to rouge after installing rouge with gem install rouge, then ran jekyll serve again. Tried restarting prompt.

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:
warning: cannot close fd before spawn
'which' is not recognized as an internal or external command,
operable program or batch file.
Liquid Exception: undefined method `[]' for nil:NilClass in _posts/2014-11-22-
welcome-to-jekyll.markdown

this is my whole config (the default except for rouge)

Site settings

title: Your awesome title
email: your-email@domain.com
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll

Build settings

markdown: kramdown
highligher: rouge

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 23, 2014

@vance, what is the full output of jekyll build --trace?

@vance

This comment has been minimized.

Copy link

vance commented Nov 23, 2014

Sure, here's the trace:

C:\dev\blog-src>jekyll build --trace
Configuration file: C:/dev/blog-src/_config.yml
Source: C:/dev/blog-src
Destination: C:/dev/blog-src/_site
Generating...
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:
warning: cannot close fd before spawn
'which' is not recognized as an internal or external command,
operable program or batch file.
Liquid Exception: undefined method []' for nil:NilClass in _posts/2014-11-22- welcome-to-jekyll.markdown C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pygments.rb-0.6.0/lib/pygments/popen.rb:3 87:inheader_to_json': undefined method []' for nil:NilClass (NoMethodError) from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pygments.rb-0.6.0/lib/pygmen ts/popen.rb:274:inhandle_header_and_return'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pygments.rb-0.6.0/lib/pygmen
ts/popen.rb:249:in block in mentos' from C:/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:91:inblock in timeout'
from C:/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:35:in block in catch' from C:/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:35:incatch'
from C:/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:35:in catch' from C:/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:106:intimeout'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pygments.rb-0.6.0/lib/pygmen
ts/popen.rb:220:in mentos' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pygments.rb-0.6.0/lib/pygmen ts/popen.rb:203:inhighlight'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/tags
/highlight.rb:81:in render_pygments' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/tags /highlight.rb:51:inrender'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/bloc
k.rb:109:in block in render_all' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/bloc k.rb:96:ineach'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/bloc
k.rb:96:in render_all' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/bloc k.rb:82:inrender'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/temp
late.rb:128:in render' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/liquid-2.6.1/lib/liquid/temp late.rb:138:inrender!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/conv
ertible.rb:106:in render_liquid' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/conv ertible.rb:233:indo_layout'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/post
.rb:261:in render' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/site .rb:298:inblock in render'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/site
.rb:297:in each' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/site .rb:297:inrender'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/site
.rb:51:in process' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/comm and.rb:28:inprocess_site'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/comm
ands/build.rb:56:in build' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/comm ands/build.rb:34:inprocess'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/lib/jekyll/comm
ands/build.rb:18:in block (2 levels) in init_with_program' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar y/command.rb:220:incall'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar
y/command.rb:220:in block in execute' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar y/command.rb:220:ineach'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar
y/command.rb:220:in execute' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar y/program.rb:42:ingo'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenar
y.rb:19:in program' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.5.1/bin/jekyll:20:i n<top (required)>'
from C:/Ruby21-x64/bin/jekyll:23:in load' from C:/Ruby21-x64/bin/jekyll:23:in

'

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 23, 2014

Can you run it again with the environment variable MENTOS_LOG set to mentos.log and paste the output of mentos.log? Alternatively, do you know the Windows filename for stdout? Maybe someone in @jekyll/windows does? The problem is here.

@juthilo

This comment has been minimized.

Copy link
Contributor

juthilo commented Nov 23, 2014

@vance undefined method []' for nil:NilClass is the same problem @alfredxing had in #3117, so downgrading Python to v2.7 should work around the problem.

@vance

This comment has been minimized.

Copy link

vance commented Nov 24, 2014

Hey, thanks again for looking into this. This is the mentos log:

Logfile created on 2014-11-23 16:58:57 -0800 by logger.rb/44203
I, [2014-11-23 16:58 #9136] INFO -- : [2014-11-23T16:58:57-08:00] Starting pid 7932 with fd 6.
I, [2014-11-23 16:58 #9136] INFO -- : [2014-11-23T16:58:57-08:00] Out header: {"method":"highlight","args":null,"kwargs":{"lexer":"ruby","options":{"encoding":"utf-8","outencoding":"utf-8"},"fd":6,"id":"MHIDSLFR","bytes":111}}
I, [2014-11-23 16:58 #9136] INFO -- : [2014-11-23T16:58:57-08:00] Size in: 00000000000000000000000110101001 (426)
I, [2014-11-23 16:58 #9136] INFO -- : [2014-11-23T16:58:57-08:00] In header:

I, [2014-11-23 16:58 #9136] INFO -- : [2014-11-23T16:58:57-08:00] Killing pid: 7932. Reason: Exiting

@vance

This comment has been minimized.

Copy link

vance commented Nov 24, 2014

alas, that was it. Python 2.7 fixed the error.

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Nov 24, 2014

Glad you got it fixed! Yeah, we should ask pygments to do a version check...

@vance

This comment has been minimized.

Copy link

vance commented Nov 24, 2014

Yeah, that's a shame... but now that it's rolling, this is awesome! I've said hello to you folks at this dumbfounded post! http://blog.foreverscape.com/2014/11/23/up-with-jekyll/

@mrshans

This comment has been minimized.

Copy link

mrshans commented Jan 17, 2015

Hello parkr
Am getting this error, what should i do?
'highlighter:' is not recognized as an internal or external command, operable program or batch file

@weineran

This comment has been minimized.

Copy link

weineran commented Jan 21, 2016

mrshans, Are you editing the highlighter setting in your _config.yml file? If not, you should. Here is how. Open _config.yml and look for a line that says
highlighter: something
and change it to
highlighter: rouge

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.