Trouble creating a new jekyll site: “Could not locate Gemfile or .bundle/ directory”

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.

2 Likes

The previous answer is correct. If you want to use global jekyll to make a new project then leave out the prefix.