Failed during stage 'building site': Build script returned non-zero exit code: 1. failed Building production JavaScript and CSS bundles

Build was up and running no problem before this. All did was add css, edited 2 images, and changed classnames for this commit. Not sure what I did that could’ve caused it. Build works locally but failes on Netlify.

Commit where it stopped working.

I have 2 more commits after this (didn’t realise deployment failed) but errors are still the same.

Before clearing cache

1:52:32 PM: Build ready to start
1:52:34 PM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
1:52:34 PM: build-image tag: v3.3.10
1:52:34 PM: buildbot version: 0d19834c19ebfe54208907d729718495339fe085
1:52:34 PM: Fetching cached dependencies
1:52:35 PM: Starting to download cache of 185.6MB
1:52:38 PM: Finished downloading cache in 3.180782745s
1:52:38 PM: Starting to extract cache
1:52:46 PM: Finished extracting cache in 8.518102583s
1:52:46 PM: Finished fetching cache in 11.749215315s
1:52:46 PM: Starting to prepare the repo for build
1:52:47 PM: Preparing Git Reference refs/heads/master
1:52:47 PM: Starting build script
1:52:48 PM: Installing dependencies
1:52:48 PM: Started restoring cached node version
1:52:52 PM: Finished restoring cached node version
1:52:53 PM: v10.20.1 is already installed.
1:52:54 PM: Now using node v10.20.1 (npm v6.14.4)
1:52:54 PM: Attempting ruby version 2.6.2, read from environment
1:52:55 PM: Using ruby version 2.6.2
1:52:56 PM: Using PHP version 5.6
1:52:56 PM: 5.2 is already installed.
1:52:56 PM: Using Swift version 5.2
1:52:56 PM: Started restoring cached node modules
1:52:56 PM: Finished restoring cached node modules
1:52:56 PM: Started restoring cached go cache
1:52:56 PM: Finished restoring cached go cache
1:52:56 PM: go version go1.12 linux/amd64
1:52:56 PM: go version go1.12 linux/amd64
1:52:56 PM: Installing missing commands
1:52:56 PM: Verify run directory
1:52:56 PM: Executing user command: gatsby build
1:52:59 PM: success open and validate gatsby-configs - 0.025s
1:52:59 PM: success load plugins - 0.643s
1:52:59 PM: success onPreInit - 0.010s
1:52:59 PM: success delete html and css files from previous builds - 0.033s
1:52:59 PM: success initialize cache - 0.055s
1:52:59 PM: success copy gatsby files - 0.057s
1:52:59 PM: success onPreBootstrap - 0.011s
1:53:00 PM: success createSchemaCustomization - 0.005s
1:53:00 PM: success source and transform nodes - 0.242s
1:53:00 PM: success building schema - 0.359s
1:53:00 PM: success createPages - 0.001s
1:53:00 PM: success createPagesStatefully - 0.090s
1:53:00 PM: success onPreExtractQueries - 0.000s
1:53:00 PM: success update schema - 0.037s
1:53:01 PM: success extract queries from components - 0.400s
1:53:01 PM: success write out requires - 0.004s
1:53:01 PM: success write out redirect data - 0.003s
1:53:01 PM: warning The icon(src/images/NexusIcon3.png) you provided to 'gatsby-plugin-manifest' is not square.
1:53:01 PM: The icons we generate will be square and for the best results we recommend you provide a square icon.
1:53:01 PM: success Build manifest and related icons - 0.219s
1:53:01 PM: success onPostBootstrap - 0.221s
1:53:01 PM: ⠀
1:53:01 PM: info bootstrap finished - 4.797 s
1:53:01 PM: ⠀
1:53:10 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
1:53:10 PM: failed Building production JavaScript and CSS bundles - 8.646s
1:53:10 PM: error Generating JavaScript bundles failed
1:53:10 PM: Cannot read property 'toLowerCase' of undefined
1:53:10 PM: not finished run queries - 9.002s
1:53:10 PM: not finished Generating image thumbnails - 8.937s
1:53:10 PM: Skipping functions preparation step: no functions directory set
1:53:10 PM: Caching artifacts
1:53:10 PM: Started saving node modules
1:53:10 PM: Finished saving node modules
1:53:10 PM: Started saving pip cache
1:53:10 PM: Finished saving pip cache
1:53:10 PM: Started saving emacs cask dependencies
1:53:10 PM: Finished saving emacs cask dependencies
1:53:10 PM: Started saving maven dependencies
1:53:10 PM: Finished saving maven dependencies
1:53:10 PM: Started saving boot dependencies
1:53:10 PM: Finished saving boot dependencies
1:53:10 PM: Started saving go dependencies
1:53:10 PM: Finished saving go dependencies
1:53:10 PM: Error running command: Build script returned non-zero exit code: 1
1:53:10 PM: Failing build: Failed to build site
1:53:11 PM: Finished processing build request in 36.624173697s

After clearing cache

2:52:29 PM: Waiting for other deploys from your team to complete
2:52:59 PM: Build ready to start
2:53:00 PM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
2:53:00 PM: build-image tag: v3.3.10
2:53:00 PM: buildbot version: 0d19834c19ebfe54208907d729718495339fe085
2:53:01 PM: Fetching cached dependencies
2:53:01 PM: Starting to download cache of 254.9KB
2:53:01 PM: Finished downloading cache in 103.088404ms
2:53:01 PM: Starting to extract cache
2:53:01 PM: Failed to fetch cache, continuing with build
2:53:01 PM: Starting to prepare the repo for build
2:53:01 PM: No cached dependencies found. Cloning fresh repo
2:53:01 PM: git clone https://github.com/nazrinshahaf/nexus
2:53:03 PM: Preparing Git Reference refs/heads/master
2:53:03 PM: Starting build script
2:53:03 PM: Installing dependencies
2:53:04 PM: v10.20.1 is already installed.
2:53:05 PM: Now using node v10.20.1 (npm v6.14.4)
2:53:05 PM: Attempting ruby version 2.6.2, read from environment
2:53:06 PM: Using ruby version 2.6.2
2:53:07 PM: Using PHP version 5.6
2:53:07 PM: 5.2 is already installed.
2:53:07 PM: Using Swift version 5.2
2:53:07 PM: Started restoring cached node modules
2:53:07 PM: Finished restoring cached node modules
2:53:07 PM: Installing NPM modules using NPM version 6.14.4
2:53:36 PM: > sharp@0.23.4 install /opt/build/repo/node_modules/sharp
2:53:36 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
2:53:36 PM: info
2:53:36 PM: sharp
2:53:36 PM:  Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
2:53:38 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
2:53:38 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:53:38 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
2:53:38 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
2:53:38 PM: > https://opencollective.com/core-js 
2:53:38 PM: > https://www.patreon.com/zloirock 
2:53:38 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
2:53:38 PM: > core-js-pure@3.6.4 postinstall /opt/build/repo/node_modules/core-js-pure
2:53:38 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:53:39 PM: > gatsby-telemetry@1.1.47 postinstall /opt/build/repo/node_modules/gatsby-telemetry
2:53:39 PM: > node src/postinstall.js || true
2:53:39 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
2:53:39 PM: > node lib/install.js
2:53:39 PM:   ✔ cwebp pre-build test passed successfully
2:53:39 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
2:53:39 PM: > node lib/install.js
2:53:40 PM:   ✔ mozjpeg pre-build test passed successfully
2:53:40 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
2:53:40 PM: > node lib/install.js
2:53:40 PM:   ✔ pngquant pre-build test passed successfully
2:53:40 PM: > gatsby-cli@2.8.27 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
2:53:40 PM: > node scripts/postinstall.js
2:53:40 PM: > gatsby@2.19.7 postinstall /opt/build/repo/node_modules/gatsby
2:53:40 PM: > node scripts/postinstall.js
2:53:43 PM: npm
2:53:43 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
2:53:43 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:53:43 PM: npm
2:53:43 PM:  WARN optional
2:53:43 PM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents):
2:53:43 PM: npm
2:53:43 PM:  WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:53:43 PM: added 1993 packages from 985 contributors and audited 2066 packages in 35.171s
2:53:45 PM: 40 packages are looking for funding
2:53:45 PM:   run `npm fund` for details
2:53:45 PM: found 77 vulnerabilities (65 low, 2 moderate, 10 high)
2:53:45 PM:   run `npm audit fix` to fix them, or `npm audit` for details
2:53:45 PM: NPM modules installed
2:53:45 PM: Started restoring cached go cache
2:53:45 PM: Finished restoring cached go cache
2:53:45 PM: go version go1.12 linux/amd64
2:53:45 PM: go version go1.12 linux/amd64
2:53:45 PM: Installing missing commands
2:53:45 PM: Verify run directory
2:53:45 PM: Executing user command: gatsby build
2:53:47 PM: success open and validate gatsby-configs - 0.020s
2:53:48 PM: success load plugins - 0.523s
2:53:48 PM: success onPreInit - 0.005s
2:53:48 PM: success delete html and css files from previous builds - 0.021s
2:53:48 PM: success initialize cache - 0.054s
2:53:48 PM: success copy gatsby files - 0.035s
2:53:48 PM: success onPreBootstrap - 0.009s
2:53:48 PM: success createSchemaCustomization - 0.003s
2:53:48 PM: success source and transform nodes - 0.193s
2:53:48 PM: success building schema - 0.295s
2:53:48 PM: success createPages - 0.000s
2:53:49 PM: success createPagesStatefully - 0.067s
2:53:49 PM: success onPreExtractQueries - 0.000s
2:53:49 PM: success update schema - 0.029s
2:53:49 PM: success extract queries from components - 0.306s
2:53:49 PM: success write out requires - 0.004s
2:53:49 PM: success write out redirect data - 0.001s
2:53:49 PM: warning The icon(src/images/NexusIcon3.png) you provided to 'gatsby-plugin-manifest' is not square.
2:53:49 PM: The icons we generate will be square and for the best results we recommend you provide a square icon.
2:53:49 PM: success Build manifest and related icons - 0.159s
2:53:49 PM: success onPostBootstrap - 0.161s
2:53:49 PM: ⠀
2:53:49 PM: info bootstrap finished - 3.999 s
2:53:49 PM: ⠀
2:54:04 PM: failed Building production JavaScript and CSS bundles - 14.262s
2:54:04 PM: error Generating JavaScript bundles failed
2:54:04 PM: Cannot read property 'toLowerCase' of undefined
2:54:04 PM: not finished run queries - 14.531s
2:54:04 PM: not finished Generating image thumbnails - 14.498s
2:54:04 PM: Skipping functions preparation step: no functions directory set
2:54:04 PM: Caching artifacts
2:54:04 PM: Started saving node modules
2:54:04 PM: Finished saving node modules
2:54:04 PM: Started saving pip cache
2:54:04 PM: Finished saving pip cache
2:54:04 PM: Started saving emacs cask dependencies
2:54:04 PM: Finished saving emacs cask dependencies
2:54:04 PM: Started saving maven dependencies
2:54:04 PM: Finished saving maven dependencies
2:54:04 PM: Started saving boot dependencies
2:54:04 PM: Finished saving boot dependencies
2:54:04 PM: Started saving go dependencies
2:54:04 PM: Finished saving go dependencies
2:54:07 PM: Error running command: Build script returned non-zero exit code: 1
2:54:07 PM: Failing build: Failed to build site
2:54:07 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
2:54:08 PM: Finished processing build request in 1m7.287501024s
1 Like

Hey there,
I’m guessing that these double slashes broke builds for you:

You have them in several places in that commit. Do you want to try deleting and seeing if your build finishes after that?

Also, this seems to be the error in both cases:

2:54:04 PM: Cannot read property 'toLowerCase' of undefined
2:54:04 PM: not finished run queries - 14.531s
2:54:04 PM: not finished Generating image thumbnails - 14.498s

I’m surprised you don’t get that error in your local builds as well :face_with_monocle: but it suggests to me that after the first group of slashes, whatever was supposed to be lowerCase-d next, was undefined.

Thanks I got it solved already.

It was a css error. Empty lines of css apparently dont show up as errors locally or online for some reason.

.CGC { margin: ;}

Also about the toLowerCase thing I cant find anything in my entire folder called toLowerCase, I didnt get that error when it succesfully deployed so hopefully its nothing.