1

I am currently trying to get Jekyll uploaded onto Gitlab pages, but, for some reason I keep running into the same error message in the pipeline:

 $ bundle exec jekyll build -d public
 Configuration file: /builds/mmellows1/mighty/_config.yml
 jekyll 3.8.6 | Error:  Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
 ERROR: Job failed: exit code 

My GEM file looks like this:

source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
    # bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.8.4"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

gem 'jekyll-compose', group: [:jekyll_plugins]

gem 'jekyll-autoprefixer'

and my gitlab-ci.yml file looks like this:

pages:
  image: ruby:2.3
  variables:
    JEKYLL_ENV: staging
    LC_ALL: C.UTF-8
  before_script:
    - bundle install
  stage: deploy
  script:
  - bundle exec jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - master
the Tin Man
  • 158,662
  • 42
  • 215
  • 303

2 Answers2

2

There are a number of options listed under https://github.com/rails/execjs (as the error says). You need to add a gem to your Gemfile that will include a JavaScript runtime.

I tend to use therubyracer, add it to your Gemfile like this:

gem "therubyracer"
philnash
  • 70,667
  • 10
  • 60
  • 88
1

You need to install a javascript runtime on ruby. The easiest way is installing nodejs itself in before_script section. Your gitlab-ci.yml should look like this:

image: ruby:2.3

variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8

before_script:
  - apt update -qq && apt install -yqq nodejs
  - bundle install
....
Dinh Tran
  • 535
  • 4
  • 13