Build error while trying to publish my Github pages
Asked Answered
S

3

6

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.

Suzan answered 2/4, 2023 at 13:8 Comment(4)
Relevant al-folio GitHub issue: github.com/alshedivat/al-folio/issues/1208. This comment seems to solve this for others in this thread i.e. "in the Settings of your repository, in the Pages section, set the branch to gh-pages".Melodic
@Melodic Thanks for your comment, yes but I don't have gh-pages branch, the only branch i have is main. and I don't know if there is anything i can do or not, I even tried to deploy it manually, but it didn't work as well.Suzan
Your Gemfile could be interesting - have you included the github.com/github/pages-gem?Milissamilissent
@Milissamilissent Yes I added that gem to the gemfile in main branch (which is the one I'm using on pages setting to publish my webpage), and I get the same error.Suzan
G
9

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.

Gildea answered 2/4, 2023 at 22:1 Comment(6)
thanks for your reply, This is my Gem file : github.com/bicmfcs/bicmfcs.github.io/blob/main/GemfileSuzan
@Suzan It contains many dependencies that the pages-gem doesn't support, so you have to switch to deploying using GitHub Actions with the starter workflow I link in the answer.Gildea
Thanks for your comment, I tried to deploy it using Github Action, didn't work though. I commented the gems that are not supported in this link didn't work either (which this one make sense :) ) and I've got the same error every time. I would appreciate your thoughts on the problem. ( I even asked the question here and here in their github discussion and in one closed issue but nobody answered yet)Suzan
@Suzan Both of your workflows use the jekyll-build-pages action, which relies on the pages-gem. You have to use the workflow I linked in my answer (this one), which sets up Ruby and installs the dependencies in your Gemfile.Gildea
@BenjaminW. thanks to your answer, it helped me realize that this issue is affectin tens of thousands of users of my jekyll theme. Thanks for the detailed explanation! I'm going to write another answer with some more detailsAsafoetida
This answer works! Important part is Remove uses: actions/jekyll-build-pages and use run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" instead.Pazit
A
1

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)

Asafoetida answered 8/8, 2023 at 16:5 Comment(0)
S
0

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.

Suzan answered 20/4, 2023 at 7:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.