Netlify deploy Failed during stage 'building site'

Hello,
My build on Netlify failed and I don’t understand why since it’s always worked with gatsby build in my local environment and I was able to put it to GitHub.
I already added an environment variable NODE_VERSION = 12.18.3 that is the same version of my local environment and it keeps failing.
At the moment it seems like the problem is an image with a “@” inside its name.
I add the clipboard to help you understand. Could someone help me please?
Thank you

2:34:59 AM: Build ready to start
2:35:01 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
2:35:01 AM: build-image tag: v3.4.1
2:35:01 AM: buildbot version: dad983e1697e9903da960ad66ea1950c0f15890b
2:35:01 AM: Building without cache
2:35:01 AM: Starting to prepare the repo for build
2:35:02 AM: No cached dependencies found. Cloning fresh repo
2:35:02 AM: git clone https://github.com/MarcoAdinolfi/Diamante-Calzature
2:35:03 AM: Preparing Git Reference refs/heads/main
2:35:04 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
2:35:04 AM: Starting build script
2:35:04 AM: Installing dependencies
2:35:04 AM: Python version set to 2.7
2:35:06 AM: Downloading and installing node v12.18.3...
2:35:06 AM: Downloading https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz...
2:35:06 AM: Computing checksum with sha256sum
2:35:06 AM: Checksums matched!
2:35:09 AM: Now using node v12.18.3 (npm v6.14.6)
2:35:09 AM: Started restoring cached build plugins
2:35:09 AM: Finished restoring cached build plugins
2:35:09 AM: Attempting ruby version 2.7.1, read from environment
2:35:10 AM: Using ruby version 2.7.1
2:35:11 AM: Using PHP version 5.6
2:35:11 AM: 5.2 is already installed.
2:35:11 AM: Using Swift version 5.2
2:35:11 AM: Started restoring cached node modules
2:35:11 AM: Finished restoring cached node modules
2:35:11 AM: Installing NPM modules using NPM version 6.14.6
2:36:01 AM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
2:36:01 AM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
2:36:01 AM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
2:36:03 AM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
2:36:03 AM: > node -e "try{require('./postinstall')}catch(e){}"
2:36:03 AM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/core-js
2:36:03 AM: > node -e "try{require('./postinstall')}catch(e){}"
2:36:04 AM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
2:36:04 AM: > node -e "try{require('./postinstall')}catch(e){}"
2:36:05 AM: > gatsby-telemetry@1.3.35 postinstall /opt/build/repo/node_modules/gatsby-telemetry
2:36:05 AM: > node src/postinstall.js || true
2:36:05 AM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
2:36:05 AM: > node lib/install.js
2:36:06 AM:   ✔ mozjpeg pre-build test passed successfully
2:36:06 AM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
2:36:06 AM: > node lib/install.js
2:36:06 AM:   ✔ pngquant pre-build test passed successfully
2:36:06 AM: > gatsby-cli@2.12.99 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
2:36:06 AM: > node scripts/postinstall.js
2:36:06 AM: > gatsby@2.24.63 postinstall /opt/build/repo/node_modules/gatsby
2:36:06 AM: > node scripts/postinstall.js
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/watchpack/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/gatsby/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/gatsby-recipes/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/gatsby-plugin-page-creator/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/gatsby-page-utils/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/chokidar/node_modules/fsevents):
2:36:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:36:09 AM: added 2398 packages from 1299 contributors and audited 2411 packages in 57.833s
2:36:12 AM: 161 packages are looking for funding
2:36:12 AM:   run `npm fund` for details
2:36:12 AM: found 2 vulnerabilities (1 low, 1 high)
2:36:12 AM:   run `npm audit fix` to fix them, or `npm audit` for details
2:36:12 AM: NPM modules installed
2:36:12 AM: Started restoring cached go cache
2:36:12 AM: Finished restoring cached go cache
2:36:12 AM: go version go1.14.4 linux/amd64
2:36:12 AM: go version go1.14.4 linux/amd64
2:36:12 AM: Installing missing commands
2:36:12 AM: Verify run directory
2:36:14 AM: ​
2:36:14 AM: ┌─────────────────────────────┐
2:36:14 AM: │        Netlify Build        │
2:36:14 AM: └─────────────────────────────┘
2:36:14 AM: ​
2:36:14 AM: ❯ Version
2:36:14 AM:   @netlify/build 5.0.0
2:36:14 AM: ​
2:36:14 AM: ❯ Flags
2:36:14 AM:   deployId: 5f879933f8a71713e96cc8e2
2:36:14 AM:   mode: buildbot
2:36:14 AM: ​
2:36:14 AM: ❯ Current directory
2:36:14 AM:   /opt/build/repo
2:36:14 AM: ​
2:36:14 AM: ❯ Config file
2:36:14 AM:   No config file was defined: using default values.
2:36:14 AM: ​
2:36:14 AM: ❯ Context
2:36:14 AM:   production
2:36:14 AM: ​
2:36:14 AM: ┌───────────────────────────────────┐
2:36:14 AM: │ 1. Build command from Netlify app │
2:36:14 AM: └───────────────────────────────────┘
2:36:14 AM: ​
2:36:14 AM: $ gatsby build
2:36:17 AM: success open and validate gatsby-configs - 0.037s
2:36:18 AM: success load plugins - 0.923s
2:36:18 AM: success onPreInit - 0.045s
2:36:18 AM: success delete html and css files from previous builds - 0.004s
2:36:18 AM: success initialize cache - 0.009s
2:36:18 AM: success copy gatsby files - 0.032s
2:36:18 AM: success onPreBootstrap - 0.252s
2:36:18 AM: success createSchemaCustomization - 0.006s
2:36:19 AM: success Checking for changed pages - 0.000s
2:36:19 AM: success source and transform nodes - 0.322s
2:36:19 AM: success building schema - 0.391s
2:36:19 AM: info Total nodes: 114, SitePage nodes: 1 (use --verbose for breakdown)
2:36:19 AM: success createPages - 0.001s
2:36:19 AM: success Checking for changed pages - 0.000s
2:36:19 AM: success createPagesStatefully - 0.116s
2:36:19 AM: success update schema - 0.030s
2:36:19 AM: success onPreExtractQueries - 0.001s
2:36:19 AM: warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
2:36:19 AM: Import it instead like:  import { graphql } from 'gatsby' in file:
2:36:19 AM: /opt/build/repo/src/pages/chi-siamo.js
2:36:20 AM: warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
2:36:20 AM: Import it instead like:  import { graphql } from 'gatsby' in file:
2:36:20 AM: /opt/build/repo/src/pages/dove-siamo.js
2:36:20 AM: warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
2:36:20 AM: Import it instead like:  import { graphql } from 'gatsby' in file:
2:36:20 AM: /opt/build/repo/src/pages/home-clienti.js
2:36:20 AM: warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
2:36:20 AM: Import it instead like:  import { graphql } from 'gatsby' in file:
2:36:20 AM: /opt/build/repo/src/pages/rivenditori.js
2:36:20 AM: success extract queries from components - 0.597s
2:36:20 AM: success write out redirect data - 0.001s
2:36:20 AM: warning The icon(src/images/FAVICON DIAMANTE-02-02.png) you provided to 'gatsby-plugin-manifest' is not square.
2:36:20 AM: The icons we generate will be square and for the best results we recommend you provide a square icon.
2:36:20 AM: success Build manifest and related icons - 0.230s
2:36:20 AM: success onPostBootstrap - 0.255s
2:36:20 AM: info bootstrap finished - 6.409s
2:36:22 AM: success run static queries - 1.582s - 2/2 1.26/s
2:36:25 AM: success run page queries - 3.193s - 8/8 2.51/s
2:36:25 AM: success write out requires - 0.005s
2:36:58 AM: warning chunk styles [mini-css-extract-plugin]
2:36:58 AM: Conflicting order. Following module has been added:
2:36:58 AM:  * css ./node_modules/css-loader??ref--12-oneOf-0-1!./node_modules/postcss-loader/src??postcss-1!./src/components/css/header2.module.css
2:36:58 AM: despite it was not able to fulfill desired ordering with these modules:
2:36:58 AM:  * css ./node_modules/css-loader??ref--12-oneOf-0-1!./node_modules/postcss-loader/src??postcss-1!./src/components/css/footer.module.css
2:36:58 AM:    - couldn't fulfill desired order of chunk group(s) component---src-pages-home-clienti-js   - while fulfilling desired order of chunk group(s) component---src-pages-404-js, component---src-pages-chi-siamo-js, component---src-pages-dove-siamo-js, component---src-pages-rivenditori-js
2:36:58 AM: failed Building production JavaScript and CSS bundles - 33.140s
2:36:58 AM: error Generating JavaScript bundles failed
2:36:58 AM: Can't resolve '../images/Freccia lunga-arancio_sottile giù @2x.png' in '/opt/build/repo/src/pages'
2:36:58 AM: If you're trying to use a package make sure that '../images/Freccia lunga-arancio_sottile giù @2x.png' is installed. If you're trying to use a local file make sure that the path is correct.
2:36:58 AM: not finished Generating image thumbnails - 37.897s
2:36:58 AM: ​
2:36:58 AM: ┌─────────────────────────────┐
2:36:58 AM: │   "build.command" failed    │
2:36:58 AM: └─────────────────────────────┘
2:36:58 AM: ​
2:36:58 AM:   Error message
2:36:58 AM:   Command failed with exit code 1: gatsby build
2:36:58 AM: ​
2:36:58 AM:   Error location
2:36:58 AM:   In Build command from Netlify app:
2:36:58 AM:   gatsby build
2:36:58 AM: ​
2:36:58 AM:   Resolved config
2:36:58 AM:   build:
2:36:58 AM:     command: gatsby build
2:36:58 AM:     commandOrigin: ui
2:36:58 AM:     environment:
2:36:58 AM:       - NODE_VERSION
2:36:58 AM:     publish: /opt/build/repo/public
2:36:58 AM: Caching artifacts
2:36:58 AM: Started saving node modules
2:36:58 AM: Finished saving node modules
2:36:58 AM: Started saving build plugins
2:36:58 AM: Finished saving build plugins
2:36:58 AM: Started saving pip cache
2:36:58 AM: Finished saving pip cache
2:36:58 AM: Started saving emacs cask dependencies
2:36:58 AM: Finished saving emacs cask dependencies
2:36:58 AM: Started saving maven dependencies
2:36:58 AM: Finished saving maven dependencies
2:36:58 AM: Started saving boot dependencies
2:36:58 AM: Finished saving boot dependencies
2:36:58 AM: Started saving go dependencies
2:36:58 AM: Finished saving go dependencies
2:37:02 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:37:02 AM: Failing build: Failed to build site
2:37:02 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
2:37:02 AM: Finished processing build request in 2m1.518187529s

Well, from the looks of that line, it seems like an image is missing. If it’s working on your local environment, there might be a chance that the file doesn’t exist in your Git Repo (maybe because of .gitignore). Do you have a repo where people can have a look?

No the image wasn’t missing, I solved it by changing the name of the image. Probably the problem came out because the system can’t read special characters. But thank you for the answer

1 Like