Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building local Jekyll site on Ubuntu #77

Open
wingedRuslan opened this issue Aug 15, 2019 · 0 comments
Open

Building local Jekyll site on Ubuntu #77

wingedRuslan opened this issue Aug 15, 2019 · 0 comments

Comments

@wingedRuslan
Copy link
Contributor

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.

  1. Install Ruby 2.1.0 or higher
    sudo apt-get install ruby-full
    Check version installed
    $ ruby --version

  2. 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)

  1. 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 make or sudo 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
  1. Re-run the step 3
    sudo bundle install

  2. 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

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant