Jekyll unmet dependencies - ruby

I have a Jekyll site which was running perfectly few days back. Today when I ran jekyll serve it has started throwing error.
Dependency Error: Yikes! It looks like you don't have jekyll-sitemap or one of its dependencies installed.
I have jekyll-sitemap installed
gem query | grep jekyll-sitemap
jekyll-sitemap (0.10.0)
If I remove jekyll-sitemap from _config.yml and run jekyll serve then it thrown an error for kramdown is not installed, which is also installed.
Searching around the net have solutions like they have multiple versions of kramdown or jekyll installed but I don't have any such issues.
Here is my _config.yml
# Site settings
title: Malabya Tewari
header-img: img/home-bg.jpg
email: imalabya#gmail.com
copyright_name: Malabya Tewari
description: "Drupal developer, Open source enthusiast, trainer, blogger from Bangalore."
keywords: "Malabya Tewari, malavya, Drupal, Drupal Developer"
baseurl: ""
url: "http://imalabya.github.io"
twitter_username: malabya88
drupal_username: malavya
facebook_username: malabya88
linkedin_username: https://www.linkedin.com/in/malabyatewari
# Build settings
markdown: kramdown
highlighter: rouge
permalink: pretty
paginate: 10
exclude: ["less","node_modules","Gruntfile.js","package.json","README.md"]
gems: [jekyll-paginate, jekyll-feed, jekyll-sitemap]
Any help will be appreciated as I am very new or Jekyll or ruby.

I took your code at https://github.com/imalabya/imalabya.github.io
Edited Gemfile to :
source 'https://rubygems.org'
gem "jekyll"
gem "jekyll-sitemap"
gem "jekyll-paginate"
gem "jekyll-feed"
Ran a bundle update, and then a bundle exec jekyll serve.
Everything is ok.

Related

Installing Jekyll 3.8.5 on GitHub Pages

Description
I'm trying to setup my personal website using GitHub Pages with Jekyll 3.8.5 as described in https://help.github.com/en/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll, but having an issue with the bundler.
Details
Bundle can't find the installed Jekyll 3.8.5
$ bundle exec jekyll 3.8.5 new .
fatal: 'jekyll 3.8.5' could not be found. You may need to install the jekyll-3.8.5 gem or a related gem to be able to use this subcommand.`
Verifying that I actually have jekyll-3.8.5
$ bundle info jekyll
* jekyll (3.8.5)
Summary: A simple, blog aware, static site generator.
Homepage: https://github.com/jekyll/jekyll
Path: /Users/macikportali/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/jekyll-3.8.5
Gemfile (installed with bundle install)
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.0.0"
# gem "jekyll", "~> 3.8.5"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
gem "jekyll-athena"
# Seems this is needed to install a lot of subcommands, see: https://github.com/jekyll/jekyll-compose
gem 'jekyll-compose', group: [:jekyll_plugins]
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# for jekyll 3.8.5
gem "github-pages", "204", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.11"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
Jekyll is used with shims
$ which jekyll
/Users/macikportali/.rbenv/shims/jekyll
My current rbenv version
$ rbenv version
2.7.1 (set by /Users/macikportali/.rbenv/version)
Question
Why bundler cannot see the installed jekyll-3.8.5 gem?
Okey, I think I figured it out. I have two different versions for Jekyll.
$ gem list jekyll
*** LOCAL GEMS ***
jekyll (4.0.1, 3.8.5)
What I did was to add underscores(_) as prefix and postfix to the version, thus, executed
bundle exec jekyll _3.8.5_ new docs
That fixed the problem because I believe this is the convention that gem follows when you have different versions.
Now, I have a different problem which is having 404 page but that's another issue to deal with.

when I use 'jekyll new <someSite>, it complain of missing folder when I `bundle exec jekyll serve`

I want to create a website from scratch using Jekyll. I use this command: `jekyll new mysite'. And it spit out this:
repo> jekyll new mysite
Running bundle install in /Users/johntowery/repo/kbsite...
Bundler: Fetching gem metadata from https://rubygems.org/...........
Bundler: Fetching gem metadata from https://rubygems.org/.
Bundler: Resolving dependencies...
Bundler: Using public_suffix 4.0.1
Bundler: Using addressable 2.7.0
Bundler: Using bundler 2.0.2
Bundler: Using colorator 1.1.0
Bundler: Using concurrent-ruby 1.1.5
Bundler: Using eventmachine 1.2.7
Bundler: Using http_parser.rb 0.6.0
Bundler: Using em-websocket 0.5.1
Bundler: Using ffi 1.11.1
Bundler: Using forwardable-extended 2.6.0
Bundler: Using i18n 1.6.0
Bundler: Using sassc 2.2.0
Bundler: Using jekyll-sass-converter 2.0.0
Bundler: Using rb-fsevent 0.10.3
Bundler: Using rb-inotify 0.10.0
Bundler: Using ruby_dep 1.5.0
Bundler: Using listen 3.1.5
Bundler: Using jekyll-watch 2.2.1
Bundler: Using kramdown 2.1.0
Bundler: Using kramdown-parser-gfm 1.1.0
Bundler: Using liquid 4.0.3
Bundler: Using mercenary 0.3.6
Bundler: Using pathutil 0.16.2
Bundler: Using rouge 3.10.0
Bundler: Using safe_yaml 1.0.5
Bundler: Using unicode-display_width 1.6.0
Bundler: Using terminal-table 1.8.0
Bundler: Using jekyll 4.0.0
Bundler: Using jekyll-feed 0.12.1
Bundler: Using jekyll-seo-tag 2.6.1
Bundler: Using minima 2.5.1
Bundler: Bundle complete! 6 Gemfile dependencies, 31 gems now installed.
Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /Users/johntowery/repo/mysite.
It created some file and directories. I understnad that this new site use gem-based theme "Minima".
repo> cd mysite
mysite> ls
404.html Gemfile Gemfile.lock _config.yml _posts about.markdown index.markdown
So far so good. I do understand that _layout, _include, etc are already inside Minima theme so that's expected. I didn't add or change anything at this point. Now I run it using: bundle execjekyll serve
I get this.
mysite> bundle exec jekyll serve
Configuration file: /Users/johntowery/repo/kbsite/_config.yml
Source: /Users/johntowery/repo/kbsite
Destination: /Users/johntowery/repo/kbsite/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
Build Warning: Layout 'post' requested in _posts/2019-09-12-welcome-to-jekyll.markdown does not exist.
Build Warning: Layout 'default' requested in 404.html does not exist.
Build Warning: Layout 'page' requested in about.markdown does not exist.
Build Warning: Layout 'home' requested in index.markdown does not exist.
done in 0.402 seconds.
Auto-regeneration: enabled for '/Users/johntowery/repo/kbsite'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
Why is it not recognizing that those "missing" Layout is in Minima gem?
The _config.yml folder: (which was autogenerated by jekyll new and I didn't modify it.)
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
#
# If you need help with YAML syntax, here are some quick references for you:
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
# https://learnxinyminutes.com/docs/yaml/
#
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Your awesome title
email: your-email#example.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: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: jekyllrb
github_username: jekyll
# Build settings
theme: minima
plugins:
- jekyll-feed
# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
# the internal "default list".
#
# Excluded items can be processed by explicitly listing the directories or
# their entries' file path in the `include:` list.
#
# exclude:
# - .sass-cache/
# - .jekyll-cache/
# - gemfiles/
# - Gemfile
# - Gemfile.lock
# - node_modules/
# - vendor/bundle/
# - vendor/cache/
# - vendor/gems/
# - vendor/ruby/
I understand that when creating new site using jekyll new <newstie>, it will create all the basic files (scaffolding). And I do know that some folders are not created because it is already in the theme gem (Minima). And I do know that you only need to create the folder (_layouts, _includes, or _sass, etc etc) if you wanted to override the 'default'. I knew that. But I expect the jekyll new <sitename> create the essential and be able to bundle exec jekyll serve successfully. But it isn't. It is not recognizing that those 'missing' folder is in Minima gem. Why is it not recognizing it? What's the point of Theme gems if Jekyll don't recognize the folder in the gem?
Is there something missing?
Im using:
macOS Mojave (10.14.6 (18G95))
ruby 2.6.4p104
Bundler version 2.0.2
jekyll 4.0.0
thanks
Ok I got it figured out.
The problem is that the installed minima gem is blank.
I went to look at the content of the minima gem by doing cd $(bundle show minima). And saw that the gem inside is blank, no folder or any file.
So I uninstall the gem then reinstall it. After that, it is working now.
I don't know why minima (2.5.1) installed was blank gem, maybe it was just a fluke, or error occured during the gem install originally.

Loading local libaries in jekyll (Liquid template library + ruby bundler)

My question is: How do I load local libaries in ruby and with bundler + jekyll?
I'm trying to load a bunch of local libraries.
For example: project_root/_plugins/fileexists.rb
I've tried following https://jekyllrb.com/docs/plugins/ but that solution assumes you have a library that can be installed from the global Gem repository.
The plugins I'm trying to load are here https://github.com/nicnocquee/appolo/tree/master/_plugins
The error I'm getting when doing 'bundle exec jekyll serve':
Dependency Error: Yikes! It looks like you don't have fileexists or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- fileexists' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
To complicate the matter, I'm using the Liquid template library. (Though this shouldnt be a Liquid problem because I get the error when doing bundle exec jekyll serve. I think..)
{% file_exists {{ fb_img_default }} %}
The code for the template is here:
https://github.com/nicnocquee/appolo/blob/master/_includes/head.html#L25
My _config.yml file for jekyll: https://pastebin.com/SphuLcVt
The Gemfile: https://pastebin.com/3ptcBx5m
Thanks in advance for ideas about how to proceed!
Library version
bundle --version
Bundler version 1.16.0
ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
gem --version
2.5.2
Ok, I figured this out.
I removed:
plugins:
- fileexists
From _config.yml
And removed:
gem 'fileexists', :path => '/home/test/xxx.github.io/_plugins/fileexists'
gem 'github-pages'
from Gemfile
The clue that github-pages packet was the problem: https://github.com/jekyll/jekyll/issues/5990#issuecomment-308231021
Short answer:
"No custom plugins will load when using github-pages because of their whitelist."

jekyll-multiple-languages-plugin cannot be found

I'm newbie to Ruby and Jekyll. Recently I've tried to install Jekyll Multiple Languages Plugin onto my GitLab Pages instance. I've managed to successfully add
'gem install jekyll-multiple-languages-plugin
bundle install'
into the .gitlab-ci.yml but when I try to add
gems:
jekyll-multiple-languages-plugin
into _config.yml in order to use it on the site my commit fails with the following error:
Using jekyll-watch 1.5.0
Using jekyll 3.4.3
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
$ jekyll build -d public
Configuration file: /builds/myusername/forty-jekyll-theme/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-multiple-languages-plugin or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-multiple-languages-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.4.3 | Error: jekyll-multiple-languages-plugin
ERROR: Job failed: exit code 1
I have used this method because any attempt to edit Gemfile ends up in commit error. I've also tried to do all presented steps except adding bundle install. In that case I get the same error, but the beginning looks like:
18 gems installed
$ gem install jekyll-multiple-languages-plugin
Successfully installed jekyll-multiple-languages-plugin-1.5.1
1 gem installed
$ jekyll build -d public
I did not manage to find the way to solve it on Stack Overflow nor other sites. For example this did not help
With the awesome support of allejo from Jekyll's IRC channel I've managed to solve the problem. Here are the steps:
I've used Gemfile. Now it looks like
source 'https://rubygems.org'
gem 'jekyll'
group :jekyll_plugins do
gem 'jekyll-multiple-languages-plugin'
end
The second modified thing was .gitlab-ci.yml (the first line - image: ruby - is also included)
image: ruby
pages:
stage: build
script:
# - gem install jekyll
- gem install bundler
# - gem install jekyll-multiple-languages-plugin
- bundle install
- bundle exec jekyll build -d public
# - jekyll build -d public
artifacts:
paths:
- public
only:
- master
It produced a bug, but it was only caused by the lack of declared language which is part of standard plugin configuration.

Jekyll - getting an error when I have Paginate in my project

I'm running 3.1.2 on Windows
When I try to add 'Paginate' to my project, I'm getting an error in cmd
Deprecation: You appear to have pagination turned on, but you haven't
included the jekyll-paginate gem. Ensure you have gems:
[jekyll-paginate] in your configuration file.
I have jekyll-paginate (1.1.0) and paginate (4.0.0) installed and it's still giving this error.
Here is my _config.yml file:
paginate: 4
paginate_path: '/blog/page:num/'
And my index.html page
{% for post in paginator.posts limit: 4 %}
What should I check, to resolve this?
Jekyll guys have removed Paginate plugin from version 3.x as it did not play nicely with more core features. You can still enable it using any of these three options
In your site source root, make a _plugins directory. Place your plugins here. Any file ending in *.rb inside this directory will be loaded before Jekyll generates your site.
In your _config.yml file, add a new array with the key gems and the values of the gem names of the plugins you’d like to use. An example:
gems: [jekyll-coffeescript, jekyll-watch, jekyll-assets]
# This will require each of these gems automatically.
Then install your plugins using gem install jekyll-paginate-category jekyll-watch jekyll-assets
Add the relevant plugins to a Bundler group in your Gemfile. An example:
group :jekyll_plugins do
gem "my-jekyll-plugin"
gem "jekyll-paginate-category"
end
Now you need to install all plugins from your Bundler group by running single command bundle install
You can find more information on jekyll plugins page
Maybe the issue is that you have 2 versions of Jekyll, one installed through "apt" and another thru "gem". Try to remove the one installed with "apt" (or whatever command you're using) and update the other version using the bundler "bundle update". I have this error I've corrected by removing Jekyll I installed by "apt" command.
** Notes: I'm using Ubuntu.
Make sure you have the following in your _config.yml file.
gems: [jekyll-paginate]

Resources