jekyll serve throws an error on Heroku - heroku

I am trying to run my jekyll site using jekyll serve but it fails. Below is a list of variations of the command I have tried:
bundle exec jekyll serve --port $PORT --host 0.0.0.0
bundle exec jekyll serve
jekyll serve --port $PORT --host 0.0.0.0
jekyll serve
For all of the above commands it fails and gives me the following error message on my heroku app:
jekyll 3.7.0 | Error: File exists # syserr_fail2_in - /app/_site/bin/erb
Please can you help. My problem is a little different from this post:
link
I have tried the following versions of ruby:
2.1.9
2.2.9
2.3.5
2.4.3
See my config below:
config.ru
require 'rack/jekyll'
run Rack::Jekyll.new
Rakefile
namespace :assets do
task :precompile do
sh 'bundle exec jekyll build'
end
end
Procfile
web: bundle exec jekyll serve --port $PORT --host 0.0.0.0
Gemfile
source 'https://rubygems.org'
gemspec
ruby '2.4.3'
gem 'jekyll'
gem 'rack-jekyll'
gem 'rake'
_config.yml
title: title
description: description
google_analytics:
theme: jekyll-theme-dinky
jekyll_auth:
ssl: true
gems: ['kramdown']
exclude: ['config.ru', 'Gemfile', 'Gemfile.lock', 'vendor', 'Procfile',
'Rakefile']
I am running my site locally with the same version of ruby, rubygems, bunlder and jekyll without this issue.
If I run this using puma it works but then my permanlinks dont work. I want to run this using jekyll serve
Please can someone help.
Herewith the output for jekyll serve --trace:
/app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1371:in `symlink': File exists # sys_fail2 - /app/_site/bin/erb (Errno::EEXIST)
from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1371:in `copy'
from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:472:in `block in copy_entry'
from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1498:in `call'
from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1498:in `wrap_traverse'
from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:469:in `copy_entry'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/static_file.rb:154:in `copy_file'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/static_file.rb:100:in `write'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:208:in `block in write'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:329:in `block (2 levels) in each_site_file'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:328:in `each'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:328:in `block in each_site_file'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:327:in `each'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:327:in `each_site_file'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:207:in `write'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:75:in `process'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/command.rb:28:in `process_site'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:65:in `build'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:36:in `process'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `block in start'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `each'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `start'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/exe/jekyll:15:in `<top (required)>'
from /app/vendor/bundle/bin/jekyll:17:in `load'
from /app/vendor/bundle/bin/jekyll:17:in `<main>'

The error seems to be because of a symlinked static_file that is attempting to write to _site/bin/erb after a _site/bin/erb has already been written..
Wonder why it doesn't causes similar error while building locally..
The app/bin has no role in a static website.. so you can tell Jekyll to ignore that directory by adding it to your exclude: array..

After trying a dozen or so things, I took a flyer on downgrading Jekyll to an earlier version. Voila! Sorry - I haven't done any root cause analysis or made an attempt to get it working with the current version.
Jekyll entry in my Gemfile:
gem 'jekyll', '3.0.0'

Related

bundle exec jekyll serve > Conflict: The following destination is shared by multiple files

Environment
Windows 10
ruby 3.0.0p0
jekyll 4.2.0
bundler
Steps to get here
installed ruby and jekyll using instructions: https://jekyllrb.com/docs/installation/windows/#installation-via-rubyinstaller
cloned existing jekyll repository (uses minimal mistakes theme)
successfully executed bundle update to update all the dependencies.
manually installed wdm
Gemfile looks like this:
source "https://rubygems.org"
gemspec
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Issue
jekyll serve and bundle exec jekyll serve commands fail with the following error:
$ bundle exec jekyll serve
Configuration file: C:/Users/linds/ueducateus-website/_config.yml
Source: C:/Users/linds/ueducateus-website
Destination: C:/Users/linds/ueducateus-website/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
Conflict: The following destination is shared by multiple files.
The written file may end up with unexpected contents.
C:/Users/linds/ueducateus-website/_site/index.html
- index.html
- index.html
- index.html
- index.html
- index.html
done in 1.511 seconds.
Auto-regeneration: enabled for 'C:/Users/linds/ueducateus-website'
------------------------------------------------
Jekyll 4.2.0 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:179:in `require_relative'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:179:in `setup'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:100:in `process'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
from C:/Ruby30-x64/bin/jekyll:23:in `load'
from C:/Ruby30-x64/bin/jekyll:23:in `<main>'
Additional
Site builds successfully on Ubuntu 18.04, with Ruby 2.5.1 and Jekyll 4.0
Unfortunately for handover, the site files need to be on Windows
This issue could be related to https://github.com/kubevirt/kubevirt.github.io/issues/665
Have run jekyll serve --trace but results are the same
It seems webrick does not come bundled with ruby 3.0. Check this jekyll github issue.
From
https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/:
The following libraries are no longer bundled gems or standard
libraries. Install the corresponding gems to use these features.
sdbm webrick net-telnet xmlrpc
You have two options
Downgrade to ruby 2.5 as you have on ubuntu OR
Add gem "webrick" in Gemfile.

Creating local gem for Jekyll and keep getting "don't have jekyll-custom-plugin or one of its dependencies installed" as jekyll unable to find it

I creating new and custom gem called as "jekyll-custom-plugin" for my Jekyll and gem this is successfully build.
robbi#pc MINGW64 /d/Workplace/ruby/jekyll-custom-plugin(master)
$ gem build jekyll-custom-plugin.gemspec
Successfully built RubyGem
Name: jekyll-custom-plugin
Version: 1.0.3
File: jekyll-custom-plugin-1.0.3.gem
I open and modified my gemfile plugin with file path and file version as needed
group :jekyll_plugins do
# put here other jekyll plugins..
gem 'jekyll-custom-plugin', '1.0.3', :path => 'd:/Workplace/ruby/jekyll-custom-plugin'
end
and my jekyll _config.yml call the plugin as usual
plugins:
- jekyll-custom-plugin
but when I try to build up the website (bundle update, bundle install and bundle exec jekylly serve), i keep getting
robbi#pc MINGW64 /d/NOPE/robbinespu.gitlab.io (master)
$ bundle exec jekyll serve
Configuration file: D:/NOPE/robbinespu.gitlab.io/_config.yml
Theme Config file: C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/octoflavor-ee4be458ed67/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-custom-plugin or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the jekyll-custom-plugin gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- jekyll-custom-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
------------------------------------------------
Jekyll 4.0.0 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
This is weid because, I already install and it show up here
robbi#pc MINGW64 /d/NOPE/robbinespu.gitlab.io (master)
$ bundle install | grep custom
Using jekyll-custom-plugin 1.0.3 from source at `d:/Workplace/ruby/jekyll-custom-plugin`
robbi#pc MINGW64 /d/NOPE/robbinespu.gitlab.io (master)
$ bundle info jekyll-custom-plugin
* jekyll-custom-plugin (1.0.3)
Summary: A Jekyll plugin to provide XXX.
Homepage: https://github.com/robbinespu/XXX
Path: d:/Workplace/ruby/jekyll-custom-plugin
even bundle said it already installed and match the version
robbi#pc MINGW64 /d/NOPE/robbinespu.gitlab.io (master)
$ bundle list | custom
* jekyll-custom-plugin (1.0.3)
here the --trace log
$ bundle exec jekyll s --trace
Configuration file: D:/NOPE/robbinespu.gitlab.io/_config.yml
Theme Config file: C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/octoflavor-ee4be458ed67/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-custom-plugin or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the jekyll-custom-plugin gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- jekyll-custom-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:73:in `rescue in block in require_with_graceful_fail': jekyll-custom-plugin (Jekyll::Errors::MissingDependencyException)
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:58:in `block in require_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:57:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:57:in `require_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/plugin_manager.rb:30:in `require_gems'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/plugin_manager.rb:22:in `conscientious_require'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/site.rb:125:in `setup'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/site.rb:35:in `initialize'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/build.rb:30:in `new'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/build.rb:30:in `process'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/exe/jekyll:15:in `<top (required)>'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bin/jekyll:23:in `load'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bin/jekyll:23:in `<main>'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:60:in `require': cannot load such file -- jekyll-custom-plugin (LoadError)
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:60:in `block in require_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:57:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/external.rb:57:in `require_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/plugin_manager.rb:30:in `require_gems'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/plugin_manager.rb:22:in `conscientious_require'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/site.rb:125:in `setup'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/site.rb:35:in `initialize'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/build.rb:30:in `new'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/build.rb:30:in `process'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/jekyll-2bc1e04620ce/exe/jekyll:15:in `<top (required)>'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bin/jekyll:23:in `load'
from C:/Ruby26-x64/lib/ruby/gems/2.6.0/bin/jekyll:23:in `<main>'
The exception message does not give the (root cause) reason for failure.
Add --trace as suggested, examine the file that is raising the error and see how the error that is being raised is constructed. This could follow a pattern like:
begin
# ...
rescue LoadError => e
raise "Generic error message not including anything from 'e.'"
end
... in which case change to:
begin
# ...
rescue LoadError => e
raise "Error message: #{e.class}: #{e}"
end
... and you'll have the root cause displayed.
If you are less fortunate, you'll see:
if $SOME_GLOBAL_FLAG
raise "Generic error message"
end
In this case the flag is set elsewhere in a rescue block for LoadError. You'll need to hunt that rescue down and print the error from there.
In either case I personally would report the omission of the root cause exception to the library that utilizes either pattern as a bug.

jekyll serve --watch command raising an error outside of vagrant

Attempting to build a site with Jekyll using the jekyll-assets gem, I noticed that my changes were not being auto regenerated despite using the --watch flag on my jekyll serve command. Was a big headache having to stop the server every time I wanted to see changes in the browser so I tried to troubleshoot the problem and after a while learned that auto regeneration will not occur with the jekyll serve --watch command in Vagrant, which I'm using.
To avoid this headache I attempted to install necessary dependencies outside of Vagrant and jekyll serve --watch but am getting the following:
Configuration file: /Users/jamestargett/Code/jekyll_fingers/_config.yml
/Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- jekyll-assets (LoadError)
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/Code/jekyll_fingers/_plugins/ext.rb:1:in `<top (required)>'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:77:in `block (2 levels) in setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:76:in `each'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:76:in `block in setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:75:in `each'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:75:in `setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:29:in `initialize'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/commands/build.rb:5:in `new'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/commands/build.rb:5:in `process'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/bin/jekyll:97:in `block (2 levels) in <top (required)>'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:66:in `run!'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
I've tried googling the problem but am pretty new to web development and a little lost.
I've also faced this problem. Looks like its a bug in the newest Jekyll 1.4.2 build. A fix can be uninstalling Jekyll 1.4.2 and installing a stable release, in my knowledge which is 1.2.1
Uninstall Jekyll and reinstall Jekyll 1.2.1 by following these commands
~ $ gem uninstall jekyll
~ $ gem install jekyll --version(="1.2.1")
Running gem install jekyll -v 1.2.1 would also work

Using jekyll with --watch flag causing build errors

I am using Jekyll on Windows 8 to work on a small project for work. So far I am loving Jekyll, but have encountered an issue when trying to serve my site with the --watch flag, which allows the site to update on refresh when changes are made to the code.
When I run my Jekyll sites I will open my cmd and cd to the proper directory. Per the Jekyll docs, I will execute chcp 65001 in the directory to change the encoding to UTF-8. Now, when I run jekyll serve -w or jekyll serve --watch I get an error dump consisting of the following:
C:\Dropbox\Workbench\lunch-and-learn>jekyll serve -w
Configuration file: C:/Dropbox/Workbench/lunch-and-learn/_config.yml
Source: C:/Dropbox/Workbench/lunch-and-learn
Destination: C:/Dropbox/Workbench/lunch-and-learn/_site
Generating... done.
Auto-regeneration: enabled
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- wdm (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:207:in `load_dependent_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapters/windows.rb:33:in `load_dependent_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:198:in `usable?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapters/windows.rb:25:in `usable?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:190:in `usable_and_works?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:57:in `block in select_and_initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:55:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/adapter.rb:55:in `select_and_initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listener.rb:291:in `initialize_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listener.rb:283:in `setup'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.1/lib/listen/listener.rb:52:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.1/lib/jekyll/commands/build.rb:56:in `watch'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.1/lib/jekyll/commands/build.rb:8:in `process'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.1/bin/jekyll:97:in `block (2 levels) in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:66:in `run!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/delegates.rb:11:in `run!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
It is worth noting that when I run the site with simply jekyll serve, without the --watch or -w flags, the site builds and serves just fine to port 4000. However this is not ideal for development.
Link to Jekyll Usage
As shown in the error message, wdm is not found.
First, update your gems
gem update
Then, manually install wdm
gem install wdm

Unable to programmatically run a Jekyll build

I'm trying to run a Jekyll build programatically, but I'm having issues in that the build crashes when trying to load some gems used by the Jekyll site's plugins.
My code looks like this (line breaks added for readability):
%x(cd #{#config['input_directory']} &&
bundle install &&
bundle exec jekyll build --config #{File.join(#config['input_directory'], "_config.yml")} --source #{#config['input_directory']} --destination #{#config['output_directory']} --trace)
When this runs, I get a stack trace that looks like this:
/_plugins/jekyll_lunr_js_search.rb:80:in `require': cannot load such file -- nokogiri (LoadError)
from /_plugins/jekyll_lunr_js_search.rb:80:in `<top (required)>'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:77:in `require'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:77:in `block (2 levels) in setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:76:in `each'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:76:in `block in setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:75:in `each'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:75:in `setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:29:in `initialize'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/commands/build.rb:5:in `new'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/commands/build.rb:5:in `process'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/bin/jekyll:77:in `block (2 levels) in <top (required)>'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/delegates.rb:11:in `run!'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
The Gemfile of the input_directory looks like this, so I'm not sure why it's not able to load nokogiri.
source 'https://rubygems.org'
gem 'directory_watcher', '= 1.4.1' # http://stackoverflow.com/questions/15591000/jekylls-auto-doesnt-work
gem 'kramdown'
gem 'nokogiri'
gem 'yui-compressor'
gem "jekyll"
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
end
Any pointers here are welcome. I get the feeling there are better ways of doing this Jekyll build programmatically too, this just seemed to be simplest to me.
Run bundle exec jekyll to ensure that it sets up the gem path correctly for Jekyll. If you're calling the program from an app that uses Bundler itself, you may need to also wrap the execution in a call to Bundler.with_clean_env.
The complete command should look like this:
Bundler.with_clean_env do
%x(cd #{#config['input_directory']} &&
bundle install &&
bundle exec jekyll build --config #{File.join(#config['input_directory'], "_config.yml")} --source #{#config['input_directory']} --destination #{#config['output_directory']} --trace)
end

Resources