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