If you have to run the command “bundle exec jekyll serve” in Linux Mint
I’ve repeatedly had to run a series of installations in Linux Mint to make the
bundle exec jekyll serve command working.
The possibility to test your Jekyll static sites locally before pushing them on GitHub is really useful.
But the basic Linux Mint installation lacks some important pieces of code.
So not only do you have to install the Ruby language but also some other piece of code needed for the system to work.
After browsing the web several times to collect the instructions I decided to consolidate them into a single post.
Now I am on Mint 19.3 Cinnamon edition.
The first step is to install Ruby.
The easiest way is to use the Mint (and Debian or Ubuntu) apt package manager with the command:
$ sudo apt-get install ruby-full
But if you want the latest release of the language it’s a good choice to use the snap service.
If you have snap, already installed just write as follows:
$ sudo snap install ruby --classic
If you don’t have snap, you must previously install it writing as follows:
$ sudo apt update $ sudo apt install snapd
Now you have Ruby installed and you can install also Jekyll and Bundler as gems with
gem install jekyll bundler but it probably won’t be enough.
The next step could be to install the GNU Compiler Collection, GCC.
Install the GNU Compiler Collection
If the bundler compilation fails you may get the following error message:
file.c:1:18: fatal error: stdio.h: No such file or directory compilation terminated.
In this case you need to install a compiler for the C language.
In Linux Mint this step is really easy and you only have to type the following command lines:
sudo apt update sudo apt install build-essential
Now you have Ruby and GCC installed but it still might not be enough because you may receive another error alert regarding the lack of zlib.
Nokogiri needs zlib
I have been warned a few times about the compilation block due to an error in the library zlib_while building _Nokogiri with a notification like the following one:
Building nokogiri using packaged libraries. Using mini_portile version 2.1.0 checking for gzdopen() in -lz... no zlib is missing; necessary for building libxml2
This means that zlib must be installed to continue the construction required by the system.
The solution found in the web and directly experienced is the following:
sudo apt-get install libpng-dev sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev
Now everything should be all right now and the command
bundle exec jekyll serve should be successful and you can enjoy your local Jekyll site before pushing it on GitHub or other online platforms.
|bundle exec jekyll serve||What we need to reach|
|sudo apt-get install ruby-full||Install Ruby from repository|
|sudo snap install ruby –classic||Install Ruby from Snap|
|sudo apt install snapd||Install Snap if not available in the system|
|sudo apt install build-essential||Install GCC and other compilers|
|sudo apt-get install libpng-dev||Install libpng-dev|
|sudo apt-get install –reinstall zlibc zlib1g zlib1g-dev||Install zlibc zlib1g zlib1g-dev|
That’s all, I hope
I hope that’s all, otherwise we’ll just have to go back and look for more information to integrate these notes.
Thank you for your attention.