Build failing when using a new repo

I need advice on tracking down an issue with a build error.

Here’s the quick history:

  • My site name is: What you’re seeing there is the old site.
  • It uses Netlify LFS for all images. I use Eleventy.
    • The new site, in a new repo, uses LFS and Eleventy, but a different build command: ‘gulp & eleventy’ instead of ‘eleventy’
  • Everything else form a config perspective is identical between sites.
    • I pointed the Netlify site to the new repo and ran a deploy.
    • Following along in the log, gulp runs fine and does its thing, eleventy runs fine and builds all pages.
    • After all pages are built, I get this error:

4:32:25 PM: “build.command” failed
4:32:25 PM: ────────────────────────────────────────────────────────────────
4:32:25 PM: ​
4:32:25 PM: Error message
4:32:25 PM: Command failed with exit code 1: CI= gulp & eleventy
4:32:25 PM: ​
4:32:25 PM: Error location
4:32:25 PM: In build.command from netlify.toml:
4:32:25 PM: CI= gulp & eleventy
4:32:25 PM: ​
4:32:25 PM: Resolved config
4:32:25 PM: build:
4:32:25 PM: command: CI= gulp & eleventy
4:32:25 PM: commandOrigin: config
4:32:25 PM: environment:
4:32:25 PM: publish: /opt/build/repo/www

• I’ve tried a few things: checked LFS, re-linked it to this site, removed images and then re-committed them, added the new ‘CI=’ to the build script (which is what you see here). But, I think I’ve exhausted all options that I can see.

• The build runs fine locally btw.

Any ideas?

Hi, @markboulton. First, the issue occurring isn’t Large Media related so I’m removing that from the subject line. Yes, the site is using Large Media but it isn’t relevant to this issue and I don’t want to confuse anyone searching the forum for answers.

The exit code being anything other than zero will cause the build to fail. I think part of the issue is the single ampersand in the build command:

CI= gulp & eleventy

That is running gulp in the background and this is known to cause problems. I’m guessing you actually want the boolean (logical) AND with a double ampersand like so:

CI= gulp && eleventy

Note, I’ve looked at your newer builds and they are timing out, not exiting with errors. This makes me suspect you move the single ampersand out of the build command and into the npm script. If so, this would also cause timeouts and changing to the double ampersand should resolve the issue.

If not, or if there are other questions, please let us know.

Thanks for the response, Luke. Unfortunately, it’s still timing out.

As you suggested, I moved the single ampersand out of build command and into the npm script. My netlify.toml is now:

  publish = "www"
  command = "npm run deploy"

With the npm script as:

  "scripts": {
     "deploy": "CI= gulp && eleventy",

I had thought this might be an issue with Gulp after your prompt.

My gulp file is:

const { watch, src, dest, parallel } = require('gulp');
const autoprefixer = require('autoprefixer');
const postcss = require('gulp-postcss');
const sourcemaps = require('gulp-sourcemaps');
const nested = require('postcss-nested');
const cssImport = require('postcss-import');
const mqpacker = require('css-mqpacker');
const cssnano = require('cssnano');

function cssTask() {
  return src('./src/_includes/css/styles.css', { allowEmpty: true })
      .pipe(postcss([mqpacker(), autoprefixer(), cssImport(), nested()]))
          discardComments: {
            removeAll: true

function watchFiles() {
  watch('./src/_includes/css/**/*.css', parallel(cssTask));

exports.default = parallel(cssTask, watchFiles);

After your suggestion of moving the build command, the build hung after the gulp task. I’d assumed this was the watchFiles function, so I removed this and as you can see by the latest log, the build progressed but then failed again.

And… just to see if this was a gulp thing, I tried removing it from the build command entirely. As I’m only using it for css processing, it should’ve built the site without the CSS (which is what happens locally). Alas, the error persists as you can see in the deploy logs.

Ok, I got to the bottom of it.

Eleventy was throwing a build error on a markdown post which had an error in the front matter (‘2019’ as the value for a tag). As soon as I removed that, the site built perfectly. Seem Netlify is a little more sensitive to these errors than running Eleventy locally (as it would just skip over this error and not built that one file, whilst continuing to build all others)

1 Like

Just a little more context here in case anyone else runs into issues. In my case, there were two issues:

  1. Netlify is a little less forgiving than Eleventy running locally when it comes to errors in YAML front matter. My error was using ‘2019’ as data for a tag.

  2. When reincorporating my gulp file, with the build command:

    publish = “www”
    command = “npm run deploy”

And the npm script as:

  "scripts": {
     "deploy": "CI= gulp && eleventy",

I was still getting an error. This was due to a Watch function in gulp file:

function watchFiles() {
  watch('./src/_includes/css/**/*.css', parallel(cssTask));

As soon as that was removed the site build just fine.

So, a combination of errors. All of which could have been mitigated by me having a closer look at the build logs for individual files that might error.

1 Like

Thanks for the detailed follow up here, @markboulton. This will definitely be helpful for any future Forums members who find themselves encountering something similar, so we appreciate you circling back to share it! :netliconfetti: