-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Here I will go through steps I needed to do in order to set up WhitakerLab github pages website locally with Jekyll. Although the github guide is great, I still had problems with setting up dependencies to spin up a server locally (make website on your own PC).
In my case, I used Ubuntu 16.04.
-
Install Ruby 2.1.0 or higher
sudo apt-get install ruby-full
Check version installed
$ ruby --version -
Install Bundler
sudo gem install bundler
Change directory to the root directory of your local Jekyll site repository. (root dir is WhitakerLab/whitakerlab.github.io repo you cloned to your PC)
- Install Jekyll and other dependencies
sudo bundle install
This command failed to run because there is the following error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing nokogiri (1.7.1), and
Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.7.1' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
github-pages was resolved to 136, which depends on
jekyll-mentions was resolved to 1.2.0, which depends on
html-pipeline was resolved to 2.8.3, which depends on
nokogiri
Let's try to run as said in the error:
sudo gem install nokogiri -v '1.7.1' --source 'https://rubygems.org/'
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
The solution might be one of the below-mentioned steps.
After each step try to run
sudo gem install nokogiri -v '1.7.1' --source 'https://rubygems.org/'
and see if can successfully install this dependency.
-
Use another ruby version, but higher than 2.1.0 link-to-solution
sudo apt-get install ruby-dev -
Install additional tools
sudo apt-get install makeorsudo apt-get install gcc make -
Update ruby-related packages
sudo gem update --system -
Install additional package zlib1g (which is actually a compression library) THIS SOLUTION worked for me.
sudo apt-get install zlib1g-dev -
Even updating the system has helped someone who has this issue.
sudo apt-get update
sudo apt-get upgrade
The output of successfully installed dependecy
Building native extensions. This could take a while...
Successfully installed nokogiri-1.7.1
Parsing documentation for nokogiri-1.7.1
Installing ri documentation for nokogiri-1.7.1
Done installing documentation for nokogiri after 11 seconds
1 gem installed
-
Re-run the step 3
sudo bundle install -
Run your WhitakerLab website locally
bundle exec jekyll serve
Here I had another error:
Error: Could not find a JavaScript runtime
Configuration file: /home/pilot/GSoC/whitakerlab.github.io/_config.yml
Configuration file: /home/pilot/GSoC/whitakerlab.github.io/_config.yml
jekyll 3.4.3 | Error: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
This error can occur when you don’t have a proper JavaScript runtime installed on your PC. To solve this, either install execjs and therubyracer gems, or install nodejs.
Available Javascript Runtimes
I chose to install node.js.
sudo apt-get install nodejs
- Re-run the command in step 5 to build your local Jekyll site
bundle exec jekyll serve
Server address: http://127.0.0.1:4000/
Copy the address to open html pages in the browser!
This is what I needed to do to build WhitakerLab website locally and see how my blog post page looks like when published on the website.