I am trying to create a Jekyll site hosted on GitHub Pages, and have been following the GitHub Pages tutorial to do so.
When I run bundle exec jekyll 4.0.1 new in the terminal (as in step 7 in the tutorial, 4.0.1 being the version of jekyll on my machine), it fails with Could not locate Gemfile or .bundle/ directory.
I’ve double checked the dependencies with jekyll -v, git --version, bundler -v, ruby -v, gem -v and all are installed so I’m not sure where I’ve gone wrong.
I’m running macOS 10.15.4.
You don’t need to prepend bundle exec when running jekyll new because you don’t have a Jekyll workspace yet.
Just run jekyll new <path> and the workspace will be created for you.
However, once you cd into that directory, you must prepend bundle exec when invoking a Jekyll command.
The previous answer is correct. If you want to use global jekyll to make a new project then leave out the prefix.
I had the same question as @matthewlaw and this suggestion didn’t immediately work for me, because I installed Jekyll using gem install jekyll bundler, as recommended in the Jekyll quickstart, and the path to gem binaries was not in my PATH (possibly because I had installed Ruby using Homebrew?)
I had to first add the gems’ path to my shell profile (as described in this StackOverflow post), to be able to run jekyll directly (instead of via bundler). I thought I’d post this here in case it helps others!