18

I'm trying to follow "Creating a GitHub Pages site with Jekyll" but when I run any of these commands:

$ bundle exec jekyll VERSION new .
$ bundle exec jekyll _4.0.0_ new .
$ bundle exec jekyll 4.0.0 new .

I get this error:

"Could not locate Gemfile or .bundle/ directory"

I have looked at several SO posts related to this error message, but none seem to have a fix for my problem. Perhaps I have missed something?

Some relevant details:

$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
$ jekyll -v
jekyll 4.0.0
$ type rvm | head -n 1
rvm is a function
$  lsb_release -a
LSB Version:    core-11.0.1ubuntu1-noarch:printing-11.0.1ubuntu1-noarch:security-11.0.1ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 19.10
Release:    19.10
Codename:   eoan
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
user2901351
  • 629
  • 8
  • 22

1 Answers1

32

The GitHub walk-through left these commands out, but Bundler's bundle init explains it:

This command is necessary to create the Gemfile:

$ bundle init

and this one to populate it with Jekyll:

$ bundle add jekyll

so that when I re-ran my setup command, it worked:

$ bundle exec jekyll 4.0.0 new . --force

The specific version of jekyll that GitHub uses can be found here.

Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135
user2901351
  • 629
  • 8
  • 22
  • 1
    brilliant, many thanks! It may be helpful to point out that `bundle` and `jekyll` should be on `$PATH`. I don't have write access to `/usr/bin/` or `/usr/local/bin` so I did `export GEM_HOME=$HOME/.gem` and I prepended it to my path as `PATH=$GEM_HOME/bin:$PATH`, which seems to work. – plijnzaad Nov 10 '21 at 14:57
  • ty @plijnzaad. Useful. – user2901351 Nov 10 '21 at 15:08