# Serve error: undefined method \`post\_read' for class \`Jekyll::Document'

**URL:** <https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353>\
**Category:** Help\
**Created:** [March 22, 2017, 10:54pm UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353 "2017-03-22T22:54:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxstarkenburg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/maxstarkenburg/32/137_2.png) [@maxstarkenburg](https://talk.jekyllrb.com/u/maxstarkenburg)\
**Post date:** [March 22, 2017, 10:54pm UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/1 "2017-03-22T22:54:00Z")

</div>

Hi all, I would appreciate any help with a problem. I’m trying to update my Jekyll site after about 5 months (and a new computer). When I try to run `yekyll serve` I get the following error message:

````auto
Configuration file: C:/cygwin64/home/gw/portfolio/_config.yml
jekyll 3.4.3 | Error: undefined method `post_read' for class `Jekyll::Document'```

Things I've tried to resolve the issue:

* Installing and serving jekyll 3.3.0 (which just gave me another error; I probably did it wrong)
* Grepping in `./portfolio/` for `post_read` or `Jekyll::Document` to no avail
* Serving from rubyinstaller / Windows shell instead of cygwin, where I get the same error message as above

Some things that might be noteworthy:

* I first Jekyllified the site on 2016-07-05 and last updated it 2016-10-07 (from another computer where things seemed to work).
* my config includes these gems: `['jekyll-paginate', 'jekyll-multiple-languages']`

Any help would be greatly appreciated. I'd be happy to run any commands you think might help debug the issue.

Thanks,

Max
````

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [March 23, 2017, 6:55am UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/2 "2017-03-23T06:55:23Z")

</div>

A link to your repo (if public) would help.  
If that’s not possible, serve again with the `--trace` switch post the output here:

```auto
# if you have a Gemfile at the root of your project and
# "Bundler" gem installed as well.
#
bundle exec jekyll serve --trace

# if you dont have a Gemfile
#
jekyll serve --trace

```

The error may have come from a plugin that implemented a `:post_read` hook.

---

<div class="post-metadata">

**Author:** ![maxstarkenburg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/maxstarkenburg/32/137_2.png) [@maxstarkenburg](https://talk.jekyllrb.com/u/maxstarkenburg)\
**Post date:** [March 23, 2017, 8:16am UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/3 "2017-03-23T08:16:12Z")

</div>

Thanks, ashmaroli, for the reply! When I run `jekyll serve --trace`, I get the following output:

````auto
Configuration file: C:/cygwin64/home/gw/portfolio/_config.yml
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-multiple-languages-2.0.3/lib/jekyll-multiple-languages/document.rb:15:in `<class:Document>': undefined method `post_read' for class `Jekyll::Document' (NameError)
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-multiple-languages-2.0.3/lib/jekyll-multiple-languages/document.rb:3:in `<module:Jekyll>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-multiple-languages-2.0.3/lib/jekyll-multiple-languages/document.rb:2:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-multiple-languages-2.0.3/lib/jekyll-multiple-languages.rb:3:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/external.rb:43:in `block in require_with_graceful_fail'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/external.rb:40:in `each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/external.rb:40:in `require_with_graceful_fail'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/plugin_manager.rb:27:in `require_gems'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/plugin_manager.rb:19:in `conscientious_require'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:111:in `setup'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:33:in `initialize'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/build.rb:28:in `new'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/build.rb:28:in `process'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/serve.rb:37:in `block (2 levels) in init_with_program'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/exe/jekyll:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.3.0/bin/jekyll:22:in `load'
        from C:/RailsInstaller/Ruby2.3.0/bin/jekyll:22:in `<main>'```

So it seems to be a problem with the `jekyll-multiple-languages` gem. My problem now is that I don't know how to proceed to fix it, since I'm really rather a newbie at all this. :) I've (at least for now) changed my repo to public in case it helps: https://bitbucket.org/maxstarkenburg/portfolio/overview
````

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [March 23, 2017, 9:23am UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/4 "2017-03-23T09:23:58Z")

</div>

Thanks for the `--trace` output and for the URL to your repo.  
This bug results from Jekyll itself as the public method `:post_read` was removed in `v3.3.0`.

There are two ways to go about this hurdle depending on what your site’s priorities are.

Till a patch is released either by Jekyll or by the plugin author, you can either:

- forego using the `jekyll-multiple-languages` plugin (or)
- downgrade to using an older version of Jekyll.

If you decide to _downgrade Jekyll_, then

- Create a `Gemfile` at the root of your site with the following:

```ruby
        source "https://rubygems.org"
        
        # use an older version of Jekyll
        gem "jekyll", "~> 3.2.1"

        # place your plugins here
        group :jekyll_plugins do
          gem "jekyll-paginate"
          gem "jekyll-multiple-languages", "~> 2.0.3"
        end

```

- Install the Bundler gem if you don’t have it already:

- Then install and run your site with the older jekyll:

**Note:** Henceforth, all jekyll commands within this project will need to have `bundle exec` prepended to them

```
    bundle exec jekyll clean
    bundle exec jekyll build

```

etc, etc.

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [March 23, 2017, 10:43am UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/5 "2017-03-23T10:43:46Z")

</div>

If you wish to proceed with the most recent version of Jekyll and use the plugin, you can serve off a patch on my fork which I’ve sent for review at the Jekyll Repo.

Create a `Gemfile` like I previously instructed, but, with small change with the `jekyll` gem:

```auto
source "https://rubygems.org"

# use a patch present on third-party git repo
gem "jekyll", git: "https://github.com/ashmaroli/jekyll.git", branch: "resurface-methods"

# place your plugins here
group :jekyll_plugins do
  gem "jekyll-paginate"
  gem "jekyll-multiple-languages", "~> 2.0.3"
end

```

**Note: This branch specified above will be updated as required, based on feedback received upstream, and may get deleted once the patch is publicly released.**

---

<div class="post-metadata">

**Author:** ![maxstarkenburg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/maxstarkenburg/32/137_2.png) [@maxstarkenburg](https://talk.jekyllrb.com/u/maxstarkenburg)\
**Post date:** [March 23, 2017, 8:12pm UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/6 "2017-03-23T20:12:03Z")

</div>

Hi ashmaroli, thank you again for all your help! When I tried following your instructions to downgrade Jekyll, I seem to run into problems with the `bundle install` portion; it always fails when trying to install ffi-1.9.18. When I try to run just `jekyll serve` with your first Gemfiile example (well, after I add a comma between `"jekyll-multiple-languages"` and `"~> 2.0.3"`, which seems to be missing? … otherwise I get other errors about whitespace and such), I get the following error:

`C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'jekyll-multiple-languages'. (Bundler::GemRequireError) Gem Load Error is: undefined method `post_read' for class `Jekyll::Document'`

When I try using your patch Gemfile, I get the following error:

`C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/source/git/git_proxy.rb:225:in `allowed_in_path': The git source https://github.com/ashmaroli/jekyll.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError)`

I tried checking that repo out and putting it in a few places, but it didn’t seem to help. But perhaps I need bundler first for either option to work, but I don’t seem to be able to get past the ffi-1.9.18 problem (no matter my attempts at trying to install earlier versions and things like that). If you’re still up for trying to help me debug this, that would be superb! I’d like to try to avoid foregoing jekyll-multiple-languages if possible. Thanks for all your help so far.

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [March 24, 2017, 4:04am UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/7 "2017-03-24T04:04:42Z")

</div>

Thanks for pointing out the missing comma. I’ve updated both Gemfile examples.

Regarding the `ffi-1.9.18` gem issue, its related to the DevKit package that you may have installed along with RailsInstaller for Windows. When you have the proper DevKit package installed, you’ll see the following message when trying to install `ffi`:

```nohighlight
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...

```

Debugging this specific issue is best suited at StackOverflow (Google will provide you links to solved tickets for similar problems)  
The main points you need to take back are that Ruby and DevKit need to be of the same bit-type (either both 32-Bit or both 64-Bit, based on your CPU Architecture and Windows version), and then the DevKit may need to be setup properly. More info in this [post](http://rubyonwindowsguides.github.io/book/ch02-04.html)

---

<div class="post-metadata">

**Author:** ![maxstarkenburg](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/maxstarkenburg/32/137_2.png) [@maxstarkenburg](https://talk.jekyllrb.com/u/maxstarkenburg)\
**Post date:** [June 9, 2017, 6:42pm UTC](https://talk.jekyllrb.com/t/serve-error-undefined-method-post-read-for-class-jekyll-document/353/8 "2017-06-09T18:42:05Z")

</div>

Hi ashmaroli,

I just wanted to say thank you for your help. I never was able to get things working in Windows/Cygwin, but I recently tried again with an Ubuntu virtual machine, and your responses were very helpful in getting things to work this time around. Thanks again!

Max
