Search code examples
rubyrubygemsjekyllbundler

bundle gem jekyll-sitemap error incompatible character encodings


Disclaimer: My first question on stackoverflow ... so first off all "Hello world"

I'm having a bad time adding jekyll-sitemap plugin to my site.
This is my Gemfile:

source 'https://rubygems.org'
gem 'jekyll-sitemap'

Running bundle results in:

Installing jekyll-sitemap 1.1.1
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
An error occurred while installing jekyll-sitemap (1.1.1), and Bundler cannot continue.
Make sure that `gem install jekyll-sitemap -v '1.1.1'` succeeds before bundling.

I'm on Ubuntu btw


Solution

  • After hours of frustration I somehow solved it ... kinda ... I just took a different path:
    first I sudo apt purge ruby and manually deleted all leftovers in /usr/, /var/ and my home directory. Then I reinstalled ruby and ruby-dev

    sudo apt install ruby ruby-dev
    

    I abandoned the idea of using bundler. Instead I installed jekyll-sitemap like that:

    sude gem install jekyll-sitemap
    

    I had to install it with sudo because without there is an error:

    ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions for the /usr/lib/ruby/gems/2.3.0 directory.
    

    Configuring Jekyll

    Jekyll's _config.yml file still needs the addition which is mentioned in the installation manual:

    gems:
      - jekyll-sitemap
    

    When I run gulp everything works as expected and the sitemap is generated.