Search code examples
rubygemsjekyllgithub-pagesjekyll-theme

Running pages locally error: Could not find 'jekyll-watch' (~> 1.1) - did find: [jekyll-watch-2.2.1] (Gem::MissingSpecVersionError)


Trying to run github pages locally (minima theme) for a project page site, but can't sever the page. I think the issue has to do with jekyll, specifically "jekyll-watch" - whatever this is.

I have (..a long time ago..) managed to serve a different gitPage locally, so it might be a conflict of revisions. I have tried various cleanups & updates (see below).

    gem cleanup 

You have requested to uninstall the gem: jekyll-3.4.3 depends on jekyll-watch (~> 1.1)

    gem install bundler

Successfully installed bundler-2.0.1 Parsing documentation for bundler-2.0.1 Done installing documentation for bundler after 4 seconds 1 gem installed

    bundle install

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. make failed, exit code 1

    gem install jekyll-watch

1 gem installed

    **bundle exec jekyll serve**

Bundler could not find compatible versions for gem "jekyll-watch": In Gemfile: github-pages x86-mingw32 was resolved to 139, which depends on jekyll (= 3.4.3) x86-mingw32 was resolved to 3.4.3, which depends on jekyll-watch (~> 1.1) x86-mingw32

Could not find gem 'jekyll-watch (~> 1.1)', which is required by gem 'jekyll (= 3.4.3)', in any of the sources.

Any ideas how I can get serve to work?


Solution

  • The primary issue here is that you're not able to install native extensions.
    If you've installed Ruby via RubyInstaller, first check your Ruby version:

    ruby -v
    

    If it is older than 2.4.0, then I suggest installing a newer Ruby from the link above and ensure that you complete the step described in this documentation.


    Once you've setup Ruby properly, update your Jekyll project by running

    bundle update
    

    If you face issues with Bundler versions, delete existing Gemfile.lock and try again.


    Note that your version of github-pages is very old. To avoid unexpected issues with jekyll build, lock your Gemfile to github-pages-v139

    # Gemfile
    
    gem "github-pages", "139", group: :jekyll_plugins
    

    Then once you're sure that Ruby is able to install all the dependencies successfully, and that your site builds fine like before, consider updating the github-pages gem by removing the version constraint you placed in the Gemfile above.