Build error while trying to publish my Github pages

2.1k Views Asked by At

I keep getting build and deployment errors while trying to publish my gh pages, it works locally, does anyone could help me?

I'm using Jekyll al-folio for my webpage. and the error I'm getting while trying to publish my gh pages is:

github-pages can't satisfy your Gemfile's dependencies.

let me know if you need any more information.

I did everything that I could find, I myself had the same problem almost a year ago and I posted the solution, but that's not working for me anymore. I used bundle update according to one solution to get an updated gemfile.lock but it didn't work either.

According to one comment, since I didn't have any gh-pages branch, I created one, and changed the branch in pages setting from main to gh-pages, I still get the same error message, and build and deployment fails.

3

There are 3 best solutions below

5
Benjamin W. On

This is caused by this change in the jekyll-build-pages action, which is what the default GitHub Pages deployment workflow uses.

The script runs bundle check to see if the default GitHub Pages dependencies loaded with the pages-gem can satisfy the dependencies somebody might have in the Gemfile in their repository.

The main reason for this warning is that people often set up custom dependencies locally, but any local Gemfile is entirely ignored in the default deployment method – and then they're surprised when their plugins don't work. This warning is meant to make that more clear.

Since this change, the warning also comes with output about which gems specifically cause the issue.

In my case, I thought my Gemfile didn't introduce anything that isn't part of the pages-gem, but the build process uses system libraries for Nokogiri instead of installing the gem, which can cause the warning.

Without seeing your Gemfile, we can only guess, but looking at the dependencies of the al-folio theme and comparing them to the default dependency versions of GitHub Pages can give us an idea.

The theme isn't published as a Gem but has about a dozen dependencies in its Gemfile that are not in pages-gem (classifier-reborn, jekyll-archives, jekyll-diagrams, ...).

To use this theme, you have to switch to publishing your site using GitHub Actions; there's a helpful official starter workflow for this.

0
bicmfcs On

I solved it using the following steps:

  • forked the main repo fromal-folio again and rename it to 'yourgithubusername.github.io'
  • make sure you check the only master branch while forking
  • go to action section of your repo and enable github actions.
  • change the url to yourusername.github.io and base url to nothing on _config.yml
  • go to setting > pages change the branch to gh-pages (Deploy action will creat it)
  • The thing is you only fork the master branch and the gh-pages branch will automatically generate by deploy action. and you should change the pages setting. and it should work now. (worked for me)

p.s. I don't know what happend in these 1 or 2 weeks, but this works now. also Benjamin's answer is helpful make sure you read that too.

0
DeanAttali On

My jekyll theme also gets this warning, and the answer provided by @BenjaminW. helped me find the solution.

As he said, this warning simply tells you that the local Gemfile contains a dependency that isn't supported by GitHub Pages. There is a bit of a catch-22 with my case, and I suspect many others as well:

Previously, the webrick library came pre-installed with Ruby. This is needed when building jekyll locally. In Ruby 3.0, they removed webrick, so now you must explicitly add webrick to your Gemfile if you want to build a jekyll site locally (GitHub also mentions this issue). The problem is that webrick is not one of the gems that are supported by GitHub Pages. Therefore, when GitHub Pages builds a site and it sees webrick, it gives you that warning message, just to let you know that you're using a dependency that GitHub Pages doesn't support.

If your case is similar to mine, it's fine to ignore. It happens because I want to be able to build my site locally AND using GitHub Pages. When I build locally, I need webrick, and when it gets build with GitHub Pages it works just fine, but it just gives you that warning. In my case, if I remove the Gemfile or the webrick line within it, the warning goes away. But then I can't build locally, so I just leave it and live with the warning.

(There is also a GitHub issue for this https://github.com/github/pages-gem/issues/887)