Why can't I install the github-pages plug-in when I set up Jekyll?

Problem
The following issues occur while following the Step.8 of guide in the following section:

System Specifications

  • Ubuntu 19.10 x64
  • Ruby: ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
  • Gem: 2.7.6.2
  • Bundler: 2.1.
  • Jekyll: 4.0.0

Reference

try bundle install and see if that works.

Thank you for your answer.

I tried that already. :sob:

Hi @bakuiseok. I’m sorry you weren’t able to install git-hub pages. That must have been frustrating. Looking at the GitHub documentation you were trying to follow, I can see why you were having trouble. The documentation could be clearer in some places.

From looking at your GitHub repo, I can see that your Gemfile contains the contents mentioned in Step 8 of the GitHub guide. The next step is to follow the instructions in those 3 lines:

# 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

In Ruby, a line that starts with a # sign is known as a comment, meaning it’s disabled. Ruby will not try to run it. When the instructions say to “uncomment the line below”, they mean you need to remove the # sign so that it looks like this:

# 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

The way Bundler works is that when you run bundle install or bundle update, it looks for gems to install or update based on what it is in the Gemfile. Since the github-pages gem in your Gemfile was commented out (meaning it had a # before it), Bundler could not find it, which explains why it did not get installed when you ran bundle install, and why it could not find it when you ran bundle update github-pages.

The next step is to remove the jekyll gem from the Gemfile, as mentioned in the first line of the Step 8 instructions:

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and

This means you can either completely remove the line that starts with gem "jekyl", or you can add a # at the beginning to comment it out, in case you change your mind later. Here is what your Gemfile should look like:

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"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
 gem "hyde"
# 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

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
  gem "jekyll-gist"
  gem "jekyll-paginate"
  gem "jekyll-seo-tag"
  gem 'jekyll-admin'
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?

Once you update your Gemfile and save it, the next step is to run bundle install. This will automatically install the latest version of github-pages. You only need to run bundle update if you want to upgrade a gem to a newer version.

Try that and let me know if it worked.

A slight correction to my previous post. The final step should be to run bundle update, not bundle install due to github-pages requiring an older version of Jekyll.

I submitted a pull request to GitHub docs to make the instructions clearer, so hopefully that should be merged soon. https://github.com/github/docs/pull/2178

I’m using WSL2 (just FYI) and setting up my local dev environment.
Ran: “bundle exec jekyll serve --drafts --livereload --force polling”
Error message: “Could not find gem ‘github-pages’ in locally installed gems. Run bundle install to install missing gems.”
Ran: “bundle install”
Error messages: “Bundler::GemNotFound: Could not find sass-3.7.4.gem for installation” and “An error occurred while installing sass (3.7.4), and Bundler cannot continue.”
Stalled at this point.

My Gemfile is below:

source “https://rubygems.org

To update to the latest github dependencies run: bundle update

To list current versions: bundle exec github-pages versions

Check github versions: Dependency versions | GitHub Pages

gem “github-pages”, group: :jekyll_plugins

group :jekyll_plugins do
gem ‘jekyll-feed’
gem ‘jekyll-paginate’
gem ‘jekyll-seo-tag’
gem ‘jekyll-sitemap’
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?