Getting error while running "bundle exec jekyll serve"

791 Views Asked by At

I am getting an error while running bundle exec jekyll serve or jekyll serve using a terminal.

I have a static website build on top of a minimal mistakes theme and its posted on Github. While editing the website, usually I used to check the website locally using Jekyll (much faster to run locally then push the changes to the website and wait until the changes take place). But for some reason I can not run the website locally using Jekyll anymore, it gives me the error described below.

To reproduce the error you can do the following (assuming that you have already installed Jekyll ):

  1. I git clone minimal mistakes theme to a certain folder using git clone https://github.com/mmistakes/minimal-mistakes.git
  2. Then cd into the minimal-mistakes folder
  3. Run bundle exec jekyll serve

To check the editing changes I used to do the following:

Run `jekyll serve` in the directory of theme contents
[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `minimal-mistakes-jekyll.gemspec`: No such file or directory - git ls-files -z. Bundler cannot continue.

 #  from C:/Users/Dell/Desktop/New folder/minimal-mistakes/minimal-mistakes-jekyll.gemspec:14
 #  -------------------------------------------
 #    spec.add_development_dependency "rake", ">= 12.3.3"
 >  end
 #  # coding: utf-8
 #  -------------------------------------------
. Bundler cannot continue.

 #  from C:/Users/Dell/Desktop/New folder/minimal-mistakes/Gemfile:2
 #  -------------------------------------------
 #  source "https://rubygems.org"
 >  gemspec #  source "https://rubygems.org"
 #  -------------------------------------------
2

There are 2 best solutions below

1
On

Have you tried running bundle before bundle exec jekyll serve?

0
On

I encountered the same problem when I was using minimal mistakes. In my case the problem was caused becuase I didn't have git installed - the command 'git ls-files -z' that the error code refers to requires it. Installing git solved the problem.