Failed deployment with jekyll (exit code 127)

Hi I’m new to jekyll deployment with Netlify. Everything works well on my localhost but won’t build on deployment.

“failed during stage ‘building site’: Build script returned non-zero exit code: 127”

My github repo is https://github.com/boschbird/xyz-dylanbird

Also in the deploy settings i have:

Build command: jekyll build

Publish directory: _site/

The following is the deployment log:

3:52:34 PM: Build ready to start
3:52:37 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
3:52:37 PM: build-image tag: v3.3.2
3:52:37 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
3:52:37 PM: Fetching cached dependencies
3:52:37 PM: Failed to fetch cache, continuing with build
3:52:37 PM: Starting to prepare the repo for build
3:52:37 PM: No cached dependencies found. Cloning fresh repo
3:52:37 PM: git clone https://github.com/boschbird/xyz-dylanbird
3:52:38 PM: Preparing Git Reference refs/heads/master
3:52:39 PM: Starting build script
3:52:39 PM: Installing dependencies
3:52:40 PM: Downloading and installing node v10.16.0...
3:52:41 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
3:52:41 PM: 
#########################
3:52:41 PM:                     35.8%
3:52:41 PM: 
#################################
3:52:41 PM: ####################################### 100.0%
3:52:41 PM: Computing checksum with sha256sum
3:52:41 PM: Checksums matched!
3:52:44 PM: Now using node v10.16.0 (npm v6.9.0)
3:52:44 PM: Attempting ruby version 2.6.2, read from environment
3:52:45 PM: Using ruby version 2.6.2
3:52:46 PM: Using PHP version 5.6
3:52:46 PM: Started restoring cached ruby gems
3:52:46 PM: Finished restoring cached ruby gems
3:52:46 PM: Installing gem bundle
3:52:46 PM: The Gemfile specifies no dependencies
3:52:46 PM: Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
3:52:46 PM: Bundled gems are installed into `/opt/build/cache/bundle`
3:52:46 PM: Gem bundle installed
3:52:46 PM: Started restoring cached go cache
3:52:46 PM: Finished restoring cached go cache
3:52:46 PM: unset GOOS;
3:52:46 PM: unset GOARCH;
3:52:46 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
3:52:46 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
3:52:46 PM: go version >&2;
3:52:46 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
3:52:46 PM: go version go1.12 linux/amd64
3:52:46 PM: Installing missing commands
3:52:46 PM: Verify run directory
3:52:46 PM: Executing user command: jekyll build
3:52:46 PM: /usr/local/bin/build: line 34: jekyll: command not found
3:52:46 PM: Skipping functions preparation step: no functions directory set
3:52:46 PM: Caching artifacts
3:52:46 PM: Started saving ruby gems
3:52:46 PM: Finished saving ruby gems
3:52:46 PM: Started saving pip cache
3:52:46 PM: Finished saving pip cache
3:52:46 PM: Started saving emacs cask dependencies
3:52:46 PM: Finished saving emacs cask dependencies
3:52:46 PM: Started saving maven dependencies
3:52:46 PM: Finished saving maven dependencies
3:52:46 PM: Started saving boot dependencies
3:52:46 PM: Finished saving boot dependencies
3:52:46 PM: Started saving go dependencies
3:52:46 PM: Finished saving go dependencies
3:52:49 PM: Error running command: Build script returned non-zero exit code: 127
3:52:49 PM: Failing build: Failed to build site
3:52:49 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
3:52:49 PM: Finished processing build request in 12.081203727s
3:52:49 PM: Shutting down logging, 0 messages pending

A good guide for setting up Jekyll and Netlify is here.

$ bundle install

This will install the jekyll gem and create a file called Gemfile.lock. This file will ensure that Netlify always uses the same version of Jekyll that you used to build your site, thus avoiding any nasty surprises.

Make sure the gemfile.lock is committing into your repository.

Thanks for this! I was following the guide (but not closely enough). In my gemfile I had commented out

# gem “jekyll”

So when I ran ‘bundle install’ it didn’t do anything. I forgot to remove the # symbol. My bad!

1 Like

Thanks @talves! and glad you got that resolved @boschbird.

1 Like

I have the same issue. However I do have my gemfile and gemlock committed to my my github repo, and i still get

jeykyll build
jekyll: command not found

PLEASE HELP!

Deployment log

11:27:05 PM: Build ready to start
11:27:09 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:27:09 PM: build-image tag: v3.3.2
11:27:09 PM: buildbot version: 89a70647dd4caa4f3273ade0957c10d63327cb10
11:27:10 PM: Fetching cached dependencies
11:27:10 PM: Starting to download cache of 255.0KB
11:27:10 PM: Finished downloading cache in 82.322517ms
11:27:10 PM: Starting to extract cache
11:27:10 PM: Failed to fetch cache, continuing with build
11:27:10 PM: Starting to prepare the repo for build
11:27:10 PM: No cached dependencies found. Cloning fresh repo
11:27:10 PM: git clone https://github.com/alitarraf/lebdata
11:27:13 PM: Preparing Git Reference refs/heads/master
11:27:13 PM: Starting build script
11:27:13 PM: Installing dependencies
11:27:15 PM: Downloading and installing node v10.16.3...
11:27:15 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz...
11:27:15 PM: 
###############
11:27:15 PM:  21.3%
11:27:16 PM: 
###
11:27:16 PM: #####################################################
11:27:16 PM: 79.1%
11:27:16 PM: 
##################################################
11:27:16 PM: ###################### 100.0%
11:27:16 PM: Computing checksum with sha256sum
11:27:16 PM: Checksums matched!
11:27:18 PM: Now using node v10.16.3 (npm v6.9.0)
11:27:19 PM: Required ruby-2.5.0 is not installed.
11:27:19 PM: To install do: 'rvm install "ruby-2.5.0"'
11:27:19 PM: Attempting ruby version 2.5.0, read from .ruby-version file
11:27:19 PM: 
11:27:19 PM: ** WARNING **
11:27:19 PM: Using custom ruby version 2.5.0, this will slow down the build.
11:27:19 PM: To ensure fast builds, set the RUBY_VERSION environment variable, or .ruby-version file, to an included ruby version.
11:27:19 PM: Included versions: 2.6.2
11:27:19 PM: 
11:27:20 PM: Required ruby-2.5.0 is not installed - installing.
11:27:20 PM: Searching for binary rubies, this might take some time.
11:27:20 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/16.04/x86_64/ruby-2.5.0.tar.bz2
11:27:20 PM: Checking requirements for ubuntu.
11:27:21 PM: Requirements installation successful.
11:27:21 PM: ruby-2.5.0 - #configure
11:27:21 PM: ruby-2.5.0 - #download
11:27:22 PM: ruby-2.5.0 - #validate archive
11:27:26 PM: ruby-2.5.0 - #extract
11:27:30 PM: ruby-2.5.0 - #validate binary
11:27:31 PM: ruby-2.5.0 - #setup
11:27:32 PM: ruby-2.5.0 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.5.0@global
11:27:32 PM: ruby-2.5.0 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems
11:27:34 PM: ............................................................
11:27:34 PM: ruby-2.5.0 - #generating global wrappers
11:27:34 PM: .......
11:27:34 PM: ruby-2.5.0 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.5.0
11:27:34 PM: ruby-2.5.0 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
11:27:34 PM: ruby-2.5.0 - #generating default wrappers
11:27:34 PM: .......
11:27:34 PM: Using /opt/buildhome/.rvm/gems/ruby-2.5.0
11:27:35 PM: Using ruby version 2.5.0
11:27:35 PM: Using PHP version 5.6
11:27:35 PM: Started restoring cached go cache
11:27:35 PM: Finished restoring cached go cache
11:27:35 PM: unset GOOS;
11:27:35 PM: unset GOARCH;
11:27:35 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
11:27:35 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
11:27:35 PM: go version >&2;
11:27:35 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
11:27:35 PM: go version go1.12 linux/amd64
11:27:35 PM: Installing missing commands
11:27:35 PM: Verify run directory
11:27:35 PM: Executing user command: jekyll build
11:27:35 PM: /usr/local/bin/build: line 60: jekyll: command not found
11:27:35 PM: Skipping functions preparation step: no functions directory set
11:27:35 PM: Caching artifacts
11:27:35 PM: Started saving pip cache
11:27:35 PM: Finished saving pip cache
11:27:35 PM: Started saving emacs cask dependencies
11:27:35 PM: Finished saving emacs cask dependencies
11:27:35 PM: Started saving maven dependencies
11:27:35 PM: Finished saving maven dependencies
11:27:35 PM: Started saving boot dependencies
11:27:35 PM: Finished saving boot dependencies
11:27:35 PM: Started saving go dependencies
11:27:35 PM: Finished saving go dependencies
11:27:38 PM: Cached ruby version 2.5.0
11:27:38 PM: Error running command: Build script returned non-zero exit code: 127
11:27:38 PM: Failing build: Failed to build site
11:27:38 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
11:27:38 PM: Finished processing build request in 28.469492417s

Committed Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem 'jekyll'
gem 'tzinfo-data',platforms: [:x64_mingw, :mingw, :mswin]
gem 'tzinfo'
gem 'jekyll-paginate'

Committed Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    colorator (1.1.0)
    concurrent-ruby (1.1.5)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    eventmachine (1.2.7-x64-mingw32)
    ffi (1.11.1-x64-mingw32)
    forwardable-extended (2.6.0)
    http_parser.rb (0.6.0)
    i18n (1.6.0)
      concurrent-ruby (~> 1.0)
    jekyll (4.0.0)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (>= 0.9.5, < 2)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.1)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.3.3)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 1.8)
    jekyll-paginate (1.1.0)
    jekyll-sass-converter (2.0.0)
      sassc (> 2.0.1, < 3.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.1.0)
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.3)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    mercenary (0.3.6)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (4.0.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.10.0)
      ffi (~> 1.0)
    rouge (3.11.0)
    ruby_dep (1.5.0)
    safe_yaml (1.0.5)
    sassc (2.2.1-x64-mingw32)
      ffi (~> 1.9)
    terminal-table (1.8.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    tzinfo (2.0.0)
      concurrent-ruby (~> 1.0)
    tzinfo-data (1.2019.3)
      tzinfo (>= 1.0.0)
    unicode-display_width (1.6.0)

PLATFORMS
  x64-mingw32

DEPENDENCIES
  jekyll
  jekyll-paginate
  tzinfo
  tzinfo-data

BUNDLED WITH
   2.0.2

I found what the problem was!

my gemfile was named:
gemfile with a lower “g” instead of Gemfile with a capital “G”.

Is there a reason why Netlify build wont read the file with a lower case?

I cant believe I spent hours on this for a capital letter!

1 Like

Definitely the cause of the problem - case sensitivity has stolen so many hours from so many devs! Thanks for posting the fix :smiley: :muscle:

1 Like

Thanks for sharing solutions here!

I had a similar issue but the reason my site wasn’t deploying was that my Gemfiles were in different folders, thus, they didn’t get committed to the repository. So after transferring them to my project folder and pushing the changes to my repo, it worked

Thanks @talves for emphasizing committing Gemfile.lock into the repository

1 Like

Glad to be of help. It’s awesome it still applies 4 years later. Have a great day.